Skip to content
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

[chore] Remove unused ocRegistry, no longer used #10215

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all 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
19 changes: 5 additions & 14 deletions service/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
"net/http"
"strconv"

ocmetric "go.opencensus.io/metric"
"go.opencensus.io/metric/metricproducer"
"go.opentelemetry.io/contrib/config"
"go.opentelemetry.io/otel/metric"
noopmetric "go.opentelemetry.io/otel/metric/noop"
"go.opentelemetry.io/otel/metric/noop"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
"go.uber.org/multierr"
Expand All @@ -31,8 +29,7 @@

type meterProvider struct {
*sdkmetric.MeterProvider
ocRegistry *ocmetric.Registry
servers []*http.Server
servers []*http.Server
}

type meterProviderSettings struct {
Expand All @@ -43,7 +40,7 @@

func newMeterProvider(set meterProviderSettings, disableHighCardinality bool) (metric.MeterProvider, error) {
if set.cfg.Level == configtelemetry.LevelNone || (set.cfg.Address == "" && len(set.cfg.Readers) == 0) {
return noopmetric.NewMeterProvider(), nil
return noop.NewMeterProvider(), nil

Check warning on line 43 in service/telemetry.go

View check run for this annotation

Codecov / codecov/patch

service/telemetry.go#L43

Added line #L43 was not covered by tests
}

if len(set.cfg.Address) != 0 {
Expand All @@ -70,12 +67,8 @@
})
}

mp := &meterProvider{
// Initialize the ocRegistry, still used by the process metrics.
ocRegistry: ocmetric.NewRegistry(),
}
metricproducer.GlobalManager().AddProducer(mp.ocRegistry)
opts := []sdkmetric.Option{}
mp := &meterProvider{}
var opts []sdkmetric.Option
for _, reader := range set.cfg.Readers {
// https://github.com/open-telemetry/opentelemetry-collector/issues/8045
r, server, err := proctelemetry.InitMetricReader(context.Background(), reader, set.asyncErrorChannel)
Expand Down Expand Up @@ -111,8 +104,6 @@
// Shutdown the meter provider and all the associated resources.
// The type signature of this method matches that of the sdkmetric.MeterProvider.
func (mp *meterProvider) Shutdown(ctx context.Context) error {
metricproducer.GlobalManager().DeleteProducer(mp.ocRegistry)

var errs error
for _, server := range mp.servers {
if server != nil {
Expand Down
Loading