1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-08-10 22:31:50 +02:00

Remove the deprecated otel/metric/global pkg (#3829)

* Remove the deprecated `otel/metric/global` pkg

* Add changelog entry

* Update PR number in changelog

* Fix lint

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
This commit is contained in:
Tyler Yahn
2023-03-07 08:36:19 -08:00
committed by GitHub
parent 3015c86cfd
commit 60f7d42d1e
15 changed files with 124 additions and 248 deletions

View File

@@ -15,10 +15,8 @@
package otel // import "go.opentelemetry.io/otel"
import (
"go.opentelemetry.io/otel/internal/global"
"go.opentelemetry.io/otel/metric"
// TODO (#3819): Remove this disablement.
// nolint: staticcheck // Temporary, while metric/global is deprecated.
"go.opentelemetry.io/otel/metric/global"
)
// Meter returns a Meter from the global MeterProvider. The name must be the
@@ -35,8 +33,6 @@ import (
//
// This is short for GetMeterProvider().Meter(name).
func Meter(name string, opts ...metric.MeterOption) metric.Meter {
// TODO (#3819): Remove this disablement.
// nolint: staticcheck // Temporary, while metric/global is deprecated.
return GetMeterProvider().Meter(name, opts...)
}
@@ -48,14 +44,10 @@ func Meter(name string, opts ...metric.MeterOption) metric.Meter {
// created or will create, are recreated automatically from the new
// GetMeterProvider.
func GetMeterProvider() metric.MeterProvider {
// TODO (#3819): Remove this disablement.
// nolint: staticcheck // Temporary, while metric/global is deprecated.
return global.MeterProvider()
}
// SetMeterProvider registers mp as the global MeterProvider.
func SetMeterProvider(mp metric.MeterProvider) {
// TODO (#3819): Remove this disablement.
// nolint: staticcheck // Temporary, while metric/global is deprecated.
global.SetMeterProvider(mp)
}