You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm using NodeJS and OpenTelemetry's auto tracing feature and I want to conditionally sample some spans, say any span that has a special attribute (the attributes sets startIncomingSpanHook in http plugin).
classMyAttributeSamplerimplementsSampler{shouldSample(context: Context,traceId: string,spanName: string,spanKind: SpanKind,attributes: SpanAttributes,links: Link[],): SamplingResult{if(attributes[FORCE_TRACING_ATTRIBUTE_KEY]){return{decision: SamplingDecision.RECORD_AND_SAMPLED}}
...
}}...functionmain(){constsampler=newMyAttributeSampler(newParentBasedSampler({root: newTraceIdRatioBasedSampler(probability)}))// pass sampler to nodeSDK, pass sampler to provider}
But that doesn't work. It seems to be working only when I create root spans in the app (usually spans come in with HTTP trace context, that is sampler processes only children spans).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Sorry, wrong repo. Please close discussion.
Hello. I'm using NodeJS and OpenTelemetry's auto tracing feature and I want to conditionally sample some spans, say any span that has a special attribute (the attributes sets
startIncomingSpanHook
in http plugin).But that doesn't work. It seems to be working only when I create root spans in the app (usually spans come in with HTTP trace context, that is sampler processes only children spans).
How can I ignore parent's sampling decision?
Beta Was this translation helpful? Give feedback.
All reactions