1- import type { Scope , Span , SpanTimeInput , TransactionContext } from '@sentry/types' ;
1+ import type {
2+ Instrumenter ,
3+ Primitive ,
4+ Scope ,
5+ Span ,
6+ SpanTimeInput ,
7+ TransactionContext ,
8+ TransactionMetadata ,
9+ } from '@sentry/types' ;
10+ import type { SpanAttributes } from '@sentry/types' ;
11+ import type { SpanOrigin } from '@sentry/types' ;
12+ import type { TransactionSource } from '@sentry/types' ;
213import { dropUndefinedKeys , logger , tracingContextFromHeaders } from '@sentry/utils' ;
314
415import { DEBUG_BUILD } from '../debug-build' ;
@@ -15,6 +26,97 @@ interface StartSpanOptions extends TransactionContext {
1526
1627 /** If defined, start this span off this scope instead off the current scope. */
1728 scope ?: Scope ;
29+
30+ /** The name of the span. */
31+ name : string ;
32+
33+ /** An op for the span. This is a categorization for spans. */
34+ op ?: string ;
35+
36+ /** The origin of the span - if it comes from auto instrumenation or manual instrumentation. */
37+ origin ?: SpanOrigin ;
38+
39+ /** Attributes for the span. */
40+ attributes ?: SpanAttributes ;
41+
42+ // All remaining fields are deprecated
43+
44+ /**
45+ * @deprecated Manually set the end timestamp instead.
46+ */
47+ trimEnd ?: boolean ;
48+
49+ /**
50+ * @deprecated This cannot be set manually anymore.
51+ */
52+ parentSampled ?: boolean ;
53+
54+ /**
55+ * @deprecated Use attributes or set data on scopes instead.
56+ */
57+ metadata ?: Partial < TransactionMetadata > ;
58+
59+ /**
60+ * The name thingy.
61+ * @deprecated Use `name` instead.
62+ */
63+ description ?: string ;
64+
65+ /**
66+ * @deprecated Use `span.setStatus()` instead.
67+ */
68+ status ?: string ;
69+
70+ /**
71+ * @deprecated Use `scope` instead.
72+ */
73+ parentSpanId ?: string ;
74+
75+ /**
76+ * @deprecated You cannot manually set the span to sampled anymore.
77+ */
78+ sampled ?: boolean ;
79+
80+ /**
81+ * @deprecated You cannot manually set the spanId anymore.
82+ */
83+ spanId ?: string ;
84+
85+ /**
86+ * @deprecated You cannot manually set the traceId anymore.
87+ */
88+ traceId ?: string ;
89+
90+ /**
91+ * @deprecated Use an attribute instead.
92+ */
93+ source ?: TransactionSource ;
94+
95+ /**
96+ * @deprecated Use attributes or set tags on the scope instead.
97+ */
98+ tags ?: { [ key : string ] : Primitive } ;
99+
100+ /**
101+ * @deprecated Use attributes instead.
102+ */
103+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
104+ data ?: { [ key : string ] : any } ;
105+
106+ /**
107+ * @deprecated Use `startTime` instead.
108+ */
109+ startTimestamp ?: number ;
110+
111+ /**
112+ * @deprecated Use `span.end()` instead.
113+ */
114+ endTimestamp ?: number ;
115+
116+ /**
117+ * @deprecated You cannot set the instrumenter manually anymore.
118+ */
119+ instrumenter ?: Instrumenter ;
18120}
19121
20122/**
@@ -259,7 +361,7 @@ function createChildSpanOrTransaction(
259361 */
260362function normalizeContext ( context : StartSpanOptions ) : TransactionContext {
261363 if ( context . startTime ) {
262- const ctx = { ...context } ;
364+ const ctx : TransactionContext & { startTime ?: SpanTimeInput } = { ...context } ;
263365 ctx . startTimestamp = spanTimeInputToSeconds ( context . startTime ) ;
264366 delete ctx . startTime ;
265367 return ctx ;
0 commit comments