Skip to content

Commit cbccf51

Browse files
authored
ref(types): Add known attribute keys to SpanAttributes type (#10295)
add known attribute keys to the `SpanAttributes` type because this way we can - enforce a concrete type for some known keys - provide auto suggestions when setting attributes
1 parent 5aac3a6 commit cbccf51

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/types/src/span.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ export type SpanAttributeValue =
2323
| Array<null | undefined | number>
2424
| Array<null | undefined | boolean>;
2525

26-
export type SpanAttributes = Record<string, SpanAttributeValue | undefined>;
26+
export type SpanAttributes = Partial<{
27+
'sentry.origin': string;
28+
'sentry.op': string;
29+
'sentry.source': string;
30+
'sentry.sample_rate': number;
31+
}> &
32+
Record<string, SpanAttributeValue | undefined>;
2733

2834
/** This type is aligned with the OpenTelemetry TimeInput type. */
2935
export type SpanTimeInput = HrTime | number | Date;

0 commit comments

Comments
 (0)