Skip to content

[component] Deprecate TelemetrySettings.MetricsLevel #12159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .chloggen/mx-psi_metricslevel-detailed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: component

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate `component.TelemetrySettings.MetricsLevel` in favor of using views and 'Enabled' method.

# One or more tracking issues or pull requests related to the change
issues: [12159]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
- Components will temporarily need the service to support using views.

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
2 changes: 1 addition & 1 deletion component/componenttest/nop_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ func TestNewNopTelemetrySettings(t *testing.T) {
assert.NotPanics(t, func() {
nts.MeterProvider.Meter("test")
})
assert.Equal(t, configtelemetry.LevelNone, nts.MetricsLevel)
assert.Equal(t, configtelemetry.LevelNone, nts.MetricsLevel) //nolint:staticcheck
assert.Equal(t, 0, nts.Resource.Attributes().Len())
}
3 changes: 3 additions & 0 deletions component/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type TelemetrySettings struct {
// MetricsLevel represents the configuration value set when the collector
// is configured. Components may use this level to decide whether it is
// appropriate to avoid computationally expensive calculations.
//
// Deprecated: [v0.119.0] Use https://pkg.go.dev/go.opentelemetry.io/otel/sdk/[email protected]/internal/x#readme-instrument-enabled instead.
// Components will temporarily need to add a view to `service/telemetry` to drop metrics based on the level.
MetricsLevel configtelemetry.Level

// Resource contains the resource attributes for the collector's telemetry.
Expand Down
3 changes: 1 addition & 2 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"go.opentelemetry.io/collector/config/configauth"
"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
Expand All @@ -49,7 +48,7 @@ var (
dummyID = component.MustNewID("dummy")
nonExistingID = component.MustNewID("nonexisting")
// Omit TracerProvider and MeterProvider in TelemetrySettings as otelhttp.Transport cannot be introspected
nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone}
nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop()}
)

func TestAllHTTPClientSettings(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
go.opentelemetry.io/collector/config/configauth v0.118.0
go.opentelemetry.io/collector/config/configcompression v1.24.0
go.opentelemetry.io/collector/config/configopaque v1.24.0
go.opentelemetry.io/collector/config/configtelemetry v0.118.0
go.opentelemetry.io/collector/config/configtls v1.24.0
go.opentelemetry.io/collector/extension/auth v0.118.0
go.opentelemetry.io/collector/extension/auth/authtest v0.118.0
Expand All @@ -35,6 +34,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.118.0 // indirect
go.opentelemetry.io/collector/extension v0.118.0 // indirect
go.opentelemetry.io/collector/pdata v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
Expand Down
Loading