Is It Allowed to Add Multiple MeterProvider in OpenTelemetry .NET #6134
-
I have a question regarding the use of multiple MeterProvider instances in OpenTelemetry .NET. Specifically, I want to add multiple MeterProvider instances, each with different meters and use different exporters. Here is the example of my use case: var meterProvider2 = Sdk.CreateMeterProviderBuilder() Is it allowed to configure multiple MeterProvider instances in this manner? Are there any potential issues or limitations I should be aware of when implementing this approach? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes it is allowed. Each MeterProvider creates a PeriodicReader, which creates a new Thread.. If you don't mind that extra need, this is totally fine. |
Beta Was this translation helpful? Give feedback.
Yes it is allowed. Each MeterProvider creates a PeriodicReader, which creates a new Thread.. If you don't mind that extra need, this is totally fine.
(Make you don't end up creating a MeterProvider per metric emission. They are fairly big objects, so create-once-re-use-till-end should be followed, but having multiple is just fine.)