Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose addSpanProcessor and getActiveSpanProcessor in tracer_provider #5131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

longlho
Copy link

@longlho longlho commented Jan 18, 2025

What does this PR do?

Expose 2 new methods in typings: addSpanProcessor and getActiveSpanProcessor for TraceProvider.

Motivation

I use addSpanProcessor primarily to chain debugging processor like

tracerProvider.addSpanProcessor({
  forceFlush: async () => {},
  onStart: (_span: Span, _parentContext: Context) => {},
  onEnd: (span: ReadableSpan) => {
    const sampled = !!(span.spanContext().traceFlags & TraceFlags.SAMPLED);
    console.log(`Span name: ${span.name}, sampled: ${sampled}`, 'span', span);
  },
  shutdown: async () => {}
});

Same for getActiveSpanProcessor.

Additional Notes

@longlho longlho requested a review from a team as a code owner January 18, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant