Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Return value of setGlobalXXX doesn't match documentation #31

@Flarna

Description

@Flarna

According to the documentation api.context.setGlobalContextManager() Returns the initialized context manager.

But actually it returns the ContextManager passed even if registerGlobal() detects that there is already a context manager installed and the passed ContextManager is not installed as global.

Similar api.propagation.setGlobalPropagator() returns the propagator passed instead that one installed global.

For api.trace.setGlobalTracerProvider() there is even a difference if installation happens as it always returns this._proxyTracerProvider.

I'm not sure what's correct here.

  • Returning the current installed global version will cause problems in case of version mismatch
  • Returning the passed in version may result in having two ContextManagers/TracerProviders/Propagators flying around

I think the best would be to return what one would get if they call api.trace.getTracerProvider() or api.context._getContextManager() (currently private) or api.propagation._getGlobalPropagator() (currently private). So either the global one (version matches) or Noop.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions