Skip to content

Stabilize Enabled API for synchronous instruments#4746

Merged
reyang merged 9 commits intoopen-telemetry:mainfrom
pellared:stab-en-instr
Dec 2, 2025
Merged

Stabilize Enabled API for synchronous instruments#4746
reyang merged 9 commits intoopen-telemetry:mainfrom
pellared:stab-en-instr

Conversation

@pellared
Copy link
Copy Markdown
Member

@pellared pellared commented Nov 21, 2025

Fixes #4215

Current implementation status:

Language Status Where it is / code reference
Go Yes (experimental) Implemented on synchronous instruments in the SDK’s experimental x package: “Instrument Enabled synchronous instruments provide an Enabled method.” See the Go package docs. (1)
.NET Yes (in BCL) Use System.Diagnostics.Metrics.Instrument.Enabled: “Gets a value that indicates if there are any listeners for this instrument.” This is the .NET runtime Metrics API that OpenTelemetry .NET uses. (2)
Java Yes (incubator) Implemented on synchronous instruments in the incubator API. (3)
JavaScript No
Python No
C++ No
Rust No
Ruby No
PHP No
Swift No
Erlang/Elixir No

Note that @open-telemetry/collector-maintainers would benefit from making it stable and would not have to do things like https://github.com/open-telemetry/opentelemetry-collector/blob/2e9c82787618ea7da3fada176abb45b5a30714bf/service/internal/obsconsumer/enabled.go.

@pellared pellared marked this pull request as ready for review November 21, 2025 19:37
@pellared pellared requested review from a team as code owners November 21, 2025 19:37
@pellared pellared changed the title Stabilize Enabled for synchronous instruments Stabilize Enabled API for synchronous instruments Nov 25, 2025
Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight preference towards also updating corresponding sdk spec to mixed stability, with the view part stable and the meterconfig part still in development.

@pellared
Copy link
Copy Markdown
Member Author

pellared commented Nov 25, 2025

Slight preference towards also updating corresponding sdk spec to mixed stability, with the view part stable and the meterconfig part still in development.

Will do as a separate PR (baby steps 😉).

@reyang reyang added this pull request to the merge queue Dec 2, 2025
Merged via the queue into open-telemetry:main with commit ca7e892 Dec 2, 2025
7 checks passed
@carlosalberto carlosalberto mentioned this pull request Dec 5, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 12, 2025
### Context

- Make the W3C randomness flag required.

([#4761](#4761))

### Traces

- Deprecate Zipkin exporter document and make exporter implementation
optional.

([#4715](#4715))
- Add spec for `AlwaysRecord` sampler

([#4699](#4699))

### Metrics

- Stabilize `Enabled` API for synchronous instruments.

([#4746](#4746))
- Allow instrument `Enabled` implementation to have additional
optimizations and features.

([#4747](#4747))

### Logs

- Stabilize `LogRecordProcessor.Enabled`.

([#4717](#4717))

### SDK Configuration

- Clarifies that guidance related to boolean environment variables is
not applicable
to other configuration interfaces.
([#4723](#4723))

---------

Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Dec 16, 2025
Per
#4746 (review)

Side note. I also made sure that this wording used for all signals (and
in the same place)

> It is not necessary for implementations to ensure that changes to any
of these
parameters are immediately visible to callers of `Enabled`.
However, the changes MUST be eventually visible.

so that the spec is similar for all signals

---------

Co-authored-by: Carlos Alberto Cortez <calberto.cortez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stabilize Metrics Instrument Enabled

10 participants