@@ -22,7 +22,7 @@ import { instrument, extractContextFromHeaders, headersWithContext } from '../in
2222import { ContextManager } from './context-manager' ;
2323import { SpanName , SPAN_DELIMITER } from './definitions' ;
2424import { SpanExporter } from './span-exporter' ;
25- import { ensureWorkflowModuleLoaded , getSdkFlagsChecking , getWorkflowModule } from './workflow-module-loader' ;
25+ import { ensureWorkflowModuleLoaded , getWorkflowModule , hasSdkFlag } from './workflow-module-loader' ;
2626
2727export * from './definitions' ;
2828
@@ -63,8 +63,7 @@ export class OpenTelemetryInboundInterceptor implements WorkflowInboundCallsInte
6363 next : Next < WorkflowInboundCallsInterceptor , 'execute' >
6464 ) : Promise < unknown > {
6565 const { workflowInfo, ContinueAsNew } = getWorkflowModule ( ) ;
66- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
67- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryInterceptorInsertYield ) ;
66+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryInterceptorInsertYield' ) ;
6867 const context = extractContextFromHeaders ( input . headers ) ;
6968 if ( shouldInjectYield ) await Promise . resolve ( ) ;
7069 return await instrument ( {
@@ -80,8 +79,7 @@ export class OpenTelemetryInboundInterceptor implements WorkflowInboundCallsInte
8079 input : SignalInput ,
8180 next : Next < WorkflowInboundCallsInterceptor , 'handleSignal' >
8281 ) : Promise < void > {
83- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
84- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryHandleSignalInterceptorInsertYield ) ;
82+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryHandleSignalInterceptorInsertYield' ) ;
8583 const context = extractContextFromHeaders ( input . headers ) ;
8684 if ( shouldInjectYield ) await Promise . resolve ( ) ;
8785 return await instrument ( {
@@ -111,8 +109,7 @@ export class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsIn
111109 input : ActivityInput ,
112110 next : Next < WorkflowOutboundCallsInterceptor , 'scheduleActivity' >
113111 ) : Promise < unknown > {
114- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
115- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryInterceptorInsertYield ) ;
112+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryInterceptorInsertYield' ) ;
116113 return await instrument ( {
117114 tracer : this . tracer ,
118115 spanName : `${ SpanName . ACTIVITY_START } ${ SPAN_DELIMITER } ${ input . activityType } ` ,
@@ -131,8 +128,7 @@ export class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsIn
131128 input : LocalActivityInput ,
132129 next : Next < WorkflowOutboundCallsInterceptor , 'scheduleLocalActivity' >
133130 ) : Promise < unknown > {
134- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
135- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryScheduleLocalActivityInterceptorInsertYield ) ;
131+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryScheduleLocalActivityInterceptorInsertYield' ) ;
136132 return await instrument ( {
137133 tracer : this . tracer ,
138134 spanName : `${ SpanName . ACTIVITY_START } ${ SPAN_DELIMITER } ${ input . activityType } ` ,
@@ -151,8 +147,7 @@ export class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsIn
151147 input : StartChildWorkflowExecutionInput ,
152148 next : Next < WorkflowOutboundCallsInterceptor , 'startChildWorkflowExecution' >
153149 ) : Promise < [ Promise < string > , Promise < unknown > ] > {
154- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
155- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryInterceptorInsertYield ) ;
150+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryInterceptorInsertYield' ) ;
156151 return await instrument ( {
157152 tracer : this . tracer ,
158153 spanName : `${ SpanName . CHILD_WORKFLOW_START } ${ SPAN_DELIMITER } ${ input . workflowType } ` ,
@@ -172,8 +167,7 @@ export class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsIn
172167 next : Next < WorkflowOutboundCallsInterceptor , 'continueAsNew' >
173168 ) : Promise < never > {
174169 const { ContinueAsNew } = getWorkflowModule ( ) ;
175- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
176- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryInterceptorInsertYield ) ;
170+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryInterceptorInsertYield' ) ;
177171 return await instrument ( {
178172 tracer : this . tracer ,
179173 spanName : `${ SpanName . CONTINUE_AS_NEW } ${ SPAN_DELIMITER } ${ input . options . workflowType } ` ,
@@ -193,8 +187,7 @@ export class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsIn
193187 input : SignalWorkflowInput ,
194188 next : Next < WorkflowOutboundCallsInterceptor , 'signalWorkflow' >
195189 ) : Promise < void > {
196- const { getActivator, SdkFlags } = getSdkFlagsChecking ( ) ;
197- const shouldInjectYield = getActivator ( ) . hasFlag ( SdkFlags . OpenTelemetryInterceptorInsertYield ) ;
190+ const shouldInjectYield = hasSdkFlag ( 'OpenTelemetryInterceptorInsertYield' ) ;
198191 return await instrument ( {
199192 tracer : this . tracer ,
200193 spanName : `${ SpanName . WORKFLOW_SIGNAL } ${ SPAN_DELIMITER } ${ input . signalName } ` ,
0 commit comments