11import type { Context , Span , SpanContext , SpanOptions , TimeInput , Tracer } from '@opentelemetry/api' ;
22import { context , SpanStatusCode , trace , TraceFlags } from '@opentelemetry/api' ;
33import { isTracingSuppressed , suppressTracing } from './utils/suppressTracing' ;
4- import type { Client , Scope , Span as SentrySpan } from '@sentry/core' ;
4+ import type { Client , Scope , Span as SentrySpan , StartSpanOptions } from '@sentry/core' ;
55import {
66 getClient ,
77 getCurrentScope ,
@@ -13,7 +13,6 @@ import {
1313 SEMANTIC_ATTRIBUTE_SENTRY_OP ,
1414 spanToStaticSpanJSON ,
1515} from '@sentry/core' ;
16- import type { OpenTelemetrySpanContext } from './types' ;
1716import { getContextFromScope } from './utils/contextData' ;
1817import { getSamplingDecision } from './utils/getSamplingDecision' ;
1918import { makeTraceState } from './utils/makeTraceState' ;
@@ -26,7 +25,7 @@ import { SENTRY_TRACE_STATE_DSC } from './constants';
2625 * @param callback - The callback to execute with the span
2726 * @param autoEnd - Whether to automatically end the span after the callback completes
2827 */
29- function _startSpan < T > ( options : OpenTelemetrySpanContext , callback : ( span : Span ) => T , autoEnd : boolean ) : T {
28+ function _startSpan < T > ( options : StartSpanOptions , callback : ( span : Span ) => T , autoEnd : boolean ) : T {
3029 const tracer = getTracer ( ) ;
3130
3231 const { name, parentSpan : customParentSpan } = options ;
@@ -106,7 +105,7 @@ function _startSpan<T>(options: OpenTelemetrySpanContext, callback: (span: Span)
106105 * You'll always get a span passed to the callback,
107106 * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
108107 */
109- export function startSpan < T > ( options : OpenTelemetrySpanContext , callback : ( span : Span ) => T ) : T {
108+ export function startSpan < T > ( options : StartSpanOptions , callback : ( span : Span ) => T ) : T {
110109 return _startSpan ( options , callback , true ) ;
111110}
112111
@@ -120,10 +119,7 @@ export function startSpan<T>(options: OpenTelemetrySpanContext, callback: (span:
120119 * You'll always get a span passed to the callback,
121120 * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
122121 */
123- export function startSpanManual < T > (
124- options : OpenTelemetrySpanContext ,
125- callback : ( span : Span , finish : ( ) => void ) => T ,
126- ) : T {
122+ export function startSpanManual < T > ( options : StartSpanOptions , callback : ( span : Span , finish : ( ) => void ) => T ) : T {
127123 return _startSpan ( options , span => callback ( span , ( ) => span . end ( ) ) , false ) ;
128124}
129125
@@ -136,7 +132,7 @@ export function startSpanManual<T>(
136132 * This function will always return a span,
137133 * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
138134 */
139- export function startInactiveSpan ( options : OpenTelemetrySpanContext ) : Span {
135+ export function startInactiveSpan ( options : StartSpanOptions ) : Span {
140136 const tracer = getTracer ( ) ;
141137
142138 const { name, parentSpan : customParentSpan } = options ;
@@ -185,8 +181,8 @@ function getTracer(): Tracer {
185181 return client ?. tracer || trace . getTracer ( '@sentry/opentelemetry' , SDK_VERSION ) ;
186182}
187183
188- function getSpanOptions ( options : OpenTelemetrySpanContext ) : SpanOptions {
189- const { startTime, attributes, kind , op, links } = options ;
184+ function getSpanOptions ( options : StartSpanOptions ) : SpanOptions {
185+ const { startTime, attributes, op, links } = options ;
190186
191187 // OTEL expects timestamps in ms, not seconds
192188 const fixedStartTime = typeof startTime === 'number' ? ensureTimestampInMilliseconds ( startTime ) : startTime ;
@@ -198,7 +194,6 @@ function getSpanOptions(options: OpenTelemetrySpanContext): SpanOptions {
198194 ...attributes ,
199195 }
200196 : attributes ,
201- kind,
202197 links,
203198 startTime : fixedStartTime ,
204199 } ;
0 commit comments