Is there a GlobalTracerProvider() method which will give me a singleton tracerprovider instance? #5877
-
I have seen this in opentelemetry-go and opentelemetry-cpp where we have a global api giving a tracer provider instance. Not sure if this is part of the OTel API, but was wondering if we have anything similar in opentelemetry-dotnet as well? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The global is required usually to obtain Tracer (ActivitySource), Meter instances. OTel .NET allows you to do create them directly using ctors, and use AddSource, AddMeter to "connect" them to the overall sdk. In short, you don't need it in OTel .NET. Check the examples in this repo and you'll see that they don't use/need global apis. |
Beta Was this translation helpful? Give feedback.
The global is required usually to obtain Tracer (ActivitySource), Meter instances. OTel .NET allows you to do create them directly using ctors, and use AddSource, AddMeter to "connect" them to the overall sdk.
In short, you don't need it in OTel .NET. Check the examples in this repo and you'll see that they don't use/need global apis.