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

Description
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.