Skip to content

Commit

Permalink
Add back global metric Meter function (#2750)
Browse files Browse the repository at this point in the history
* Add back global metric Meter function

* Add change to changelog
  • Loading branch information
MrAlias committed Mar 30, 2022
1 parent 4385621 commit ceead4a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package.
This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750)

### Changed

- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`.
Expand Down
11 changes: 11 additions & 0 deletions metric/global/global.go
Expand Up @@ -19,6 +19,17 @@ import (
"go.opentelemetry.io/otel/metric/internal/global"
)

// Meter returns a Meter from the global MeterProvider. The
// instrumentationName must be the name of the library providing
// instrumentation. This name may be the same as the instrumented code only if
// that code provides built-in instrumentation. If the instrumentationName is
// empty, then a implementation defined default name will be used instead.
//
// This is short for MeterProvider().Meter(name)
func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter {
return MeterProvider().Meter(instrumentationName, opts...)
}

// MeterProvider returns the registered global trace provider.
// If none is registered then a No-op MeterProvider is returned.
func MeterProvider() metric.MeterProvider {
Expand Down

0 comments on commit ceead4a

Please sign in to comment.