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

[sdk-trace] make activeSpanProcessor private #4792

Closed
1 of 4 tasks
pichlermarc opened this issue Jun 14, 2024 · 5 comments · Fixed by #4965
Closed
1 of 4 tasks

[sdk-trace] make activeSpanProcessor private #4792

pichlermarc opened this issue Jun 14, 2024 · 5 comments · Fixed by #4965

Comments

@pichlermarc
Copy link
Member

pichlermarc commented Jun 14, 2024

Description

activeSpanProcessor is currently public and that allows users to modify the span processor by setting it on the fly even though the should be done via addSpanProcesssor() or - ideally - only via the constructor as the user is not supposed to hold on to the SDK instance of the TracerProvider after the initialization phase, as this can have unintended side-effects on the exported telemetry and should therefore be avoided.

This issue is considered done when

  • the activeSpanProcessor property at has been marked private or protected
  • it has been verified that activeSpanProcessor is not public in any other way for the BasicTracerProvider
  • it has been verified that activeSpanProcessor is not public in any other way for the WebTracerProvider
  • it has been verified that activeSpanProcessor is not public in any other way for the NodeTracerProvider
@legalimpurity
Copy link
Contributor

@pichlermarc can I pick this up?

@david-luna
Copy link
Contributor

  • it has been verified that activeSpanProcessor is not public in any other way for the BasicTracerProvider
  • it has been verified that activeSpanProcessor is not public in any other way for the WebTracerProvider
  • it has been verified that activeSpanProcessor is not public in any other way for the NodeTracerProvider

BasicTraceProvider has a getter function getActiveSpanProcessor which is used in Tracer & Span classes. The ref is accessible but user cannot replace it so I guess we could check those

should be done via addSpanProcesssor() or - ideally - only via the constructor as the user is not supposed to hold on to the SDK instance of the TracerProvider after the initialization phase,

@pichlermarc as for now the constructor does not accept processors. should we go for it?

@pichlermarc
Copy link
Member Author

@pichlermarc as for now the constructor does not accept processors. should we go for it?

I'd say we go for it, but before starting let me check in the temperature on this with the other @open-telemetry/javascript-maintainers - I wonder if the following interfaces are necessary at all:

  • TracerProvider#addSpanProcessor() (why not do it with the constructor, it's an interface so if one absolutely has to add SpanProcessors later you can create your own SpanProcesssor implementation that implements functionality of handling newly added processors, my guess is the vast majority of users don't need that functionality and are just confused by it)
  • TracerProvider#getActiveSpanProcessor() (why get it back once set? it seems to have internal reasons rather than being intended for the end-user so I think it should not be visible to them)

@david-luna
Copy link
Contributor

@pichlermarc #5134 does remove the addSpanProcessor API. Since the change affect lots of files I'd prefer to defer the discussion and possible PR of removing getActiveSpanProcessor

Your feedback is very welcome :)

@david-luna
Copy link
Contributor

Done in #5152 & #5192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants