open-telemetry / open-telemetry/opentelemetry-cpp

MeterProvider support for updating the MeterConfigurator

Open
#4,256 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted triage/accepted
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 MeterConfigurator must be thread safe
  • Update must create and apply a new MeterConfig for all existing Meters created by the provider
  • The updated MeterConfigurator must apply to new Meters created by the provider
  • GetMeter and UpdateMeterConfigurator must prevent race conditions on the meters
  • Updating the MeterConfig (the enabled flag) of a Meter must not block other methods of the Meter class
  • 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.