open-telemetry / open-telemetry/opentelemetry-cpp
MeterProvider support for updating the MeterConfigurator
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 632
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 75
Description
Feature
Add an UpdateMeterConfigurator method to the SDK MeterProvider which recomputes and sets the new MeterConfig (the enabled flag) for existing and new meters.
Background
The spec allows for updating the MeterConfigurator at runtime.
https://opentelemetry.io/docs/specs/otel/metrics/sdk/#meterconfigurator
A MeterConfigurator is a function which computes the MeterConfig for a Meter.
...
This function is called when a Meter is first created, and for each outstanding Meter when a MeterProvider’s MeterConfigurator is updated (if updating is supported). Therefore, it is important that it returns quickly.
Enabling and disabling meters by instrumentation scope at runtime can be valuable for debugging, testing, and managing signals in production.
Requirements:
- Updating the
MeterConfiguratormust be thread safe - Update must create and apply a new MeterConfig for all existing Meters created by the provider
- The updated
MeterConfiguratormust apply to new Meters created by the provider GetMeterandUpdateMeterConfiguratormust prevent race conditions on the meters- Updating the
MeterConfig(the enabled flag) of a Meter must not block other methods of theMeterclass - There should be an example of how to use the method :)
See the tracer and logger configurator update PRs for common patterns and examples:
#4065 Tracer Configurator update support
#4224 Logger Configurator update support
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SDK MeterProvider, focusing on GetMeter and the MeterConfig enabled flag, then review tracer PR #4065 and logger PR #4224 for established configurator-update patterns. Done means a thread-safe UpdateMeterConfigurator applies new configurations to existing and future meters without blocking other Meter methods, with a usage example included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100