Skip to content

Commit ca7e892

Browse files
Stabilize Enabled API for synchronous instruments (#4746)
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** | | [1]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric/internal/x "go.opentelemetry.io/otel/sdk/metric/internal/x - Go Packages" [2]: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics.instrument.enabled?view=net-9.0 "Instrument.Enabled Property (System.Diagnostics.Metrics)" [3]: https://github.com/open-telemetry/opentelemetry-java/tree/main/api/incubator/src/main/java/io/opentelemetry/api/incubator/metrics 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. --------- Co-authored-by: Carlos Alberto Cortez <[email protected]>
1 parent fdaa149 commit ca7e892

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ release.
1818

1919
### Metrics
2020

21+
- Stabilize `Enabled` API for synchronous instruments.
22+
([#4746](https://github.com/open-telemetry/opentelemetry-specification/pull/4746))
2123
- Allow instrument `Enabled` implementation to have additional optimizations and features.
2224
([#4747](https://github.com/open-telemetry/opentelemetry-specification/pull/4747))
2325

specification/metrics/api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,14 @@ or something else).
472472

473473
### General operations
474474

475-
All instruments SHOULD provide functions to:
475+
All [synchronous instruments](#synchronous-instrument-api) SHOULD provide functions to:
476476

477477
* [Report if instrument is `Enabled`](#enabled)
478478

479479
#### Enabled
480480

481-
**Status**: [Development](../document-status.md)
482-
483481
To help users avoid performing computationally expensive operations when
484-
recording measurements, [synchronous Instruments](#synchronous-instrument-api)
482+
recording measurements, [synchronous instruments](#synchronous-instrument-api)
485483
SHOULD provide this `Enabled` API.
486484

487485
There are currently no required parameters for this API. Parameters can be

0 commit comments

Comments
 (0)