Use the Enable method of synchronous metric instruments (original) (raw)
The Enabled method was added to all synchronous instruments in #7763. This new method should be used in all instrumentation within the project, and documentation should be updated/created to promote its use.
Instrumentation
Update all uses of the metric API to check if the instrument is enabled prior to performing any computationally expensive operations.
- go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc/internal/observ
- go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp/internal/observ
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/observ
- go.opentelemetry.io/otel/exporters/prometheus/internal/observ
- go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/internal/observ
- go.opentelemetry.io/otel/exporters/stdout/stdouttrace/internal/observ
- go.opentelemetry.io/otel/sdk/log/internal/observ
- go.opentelemetry.io/otel/sdk/trace/internal/observ
- go.opentelemetry.io/otel/semconv/templates/registry/go/instrument.j2
- go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
- go.opentelemetry.io/contrib/instrumentation/runtime
- Does not include any synchronous instruments
- go.opentelemetry.io/contrib/instrumentation/runtime/internal/deprecatedruntime
Documentation
- Update our contributing documentation to describe recommended use of this API
- Update opentelemetry.io documentation for Go instrumentation