Skip to content

Commit

Permalink
Re-deprecate LeveledMeterProvider, wrong usage of colons (open-teleme…
Browse files Browse the repository at this point in the history
…try#11697)

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Nov 19, 2024
1 parent e5f0e17 commit 63c7fec
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
25 changes: 25 additions & 0 deletions .chloggen/re-deprecate-leveled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: Mark `TelemetrySettings.LeveledMeterProvider` as deprecated

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

# (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:

# 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]
8 changes: 2 additions & 6 deletions component/componenttest/obsreporttest.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -130,11 +129,8 @@ func SetupTelemetry(id component.ID) (TestTelemetry, error) {
Logger: zap.NewNop(),
TracerProvider: sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(settings.SpanRecorder)),
MeterProvider: mp,
LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider {
return mp
},
MetricsLevel: configtelemetry.LevelDetailed,
Resource: pcommon.NewResource(),
MetricsLevel: configtelemetry.LevelDetailed,
Resource: pcommon.NewResource(),
}

return settings, nil
Expand Down
4 changes: 1 addition & 3 deletions component/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ type TelemetrySettings struct {
// MeterProvider that the factory can pass to other instrumented third-party libraries.
MeterProvider metric.MeterProvider

// LeveledMeterProvider returns a MeterProvider for a Level that the factory can
// pass to other instrumented third-party libraries.
// Deprecated [v0.114.0]: use MeterProvider instead.
// Deprecated: [v0.114.0] use MeterProvider instead.
LeveledMeterProvider func(level configtelemetry.Level) metric.MeterProvider

// MetricsLevel represents the configuration value set when the collector
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 @@ -21,7 +21,6 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/metric"
"go.uber.org/zap"
"go.uber.org/zap/zaptest/observer"

Expand Down Expand Up @@ -52,7 +51,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, LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { return nil }}
nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone}
)

func TestAllHTTPClientSettings(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions service/internal/proctelemetry/process_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
otelprom "go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/metric"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"

Expand Down Expand Up @@ -56,9 +55,6 @@ func setupTelemetry(t *testing.T) testTelemetry {

settings.TelemetrySettings.MetricsLevel = configtelemetry.LevelDetailed
settings.TelemetrySettings.MeterProvider = meterProvider
settings.TelemetrySettings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider {
return meterProvider
}

settings.promHandler = promhttp.HandlerFor(promReg, promhttp.HandlerOpts{})

Expand Down

0 comments on commit 63c7fec

Please sign in to comment.