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

Move metric No-Op to metric/noop #3941

Merged
merged 7 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Changed

- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941)
- `NewNoopMeterProvider` is replaced with `noop.NewMeterProvider`
MrAlias marked this conversation as resolved.
Show resolved Hide resolved

## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23

This is a release candidate for the v1.15.0/v0.38.0 release.
Expand Down
5 changes: 3 additions & 2 deletions internal/global/instruments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/noop"
)

func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) {
Expand All @@ -36,7 +37,7 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal
}
}()

setDelegate(metric.NewNoopMeterProvider().Meter(""))
setDelegate(noop.NewMeterProvider().Meter(""))
close(finish)
}

Expand All @@ -53,7 +54,7 @@ func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue),
}
}()

setDelegate(metric.NewNoopMeterProvider().Meter(""))
setDelegate(noop.NewMeterProvider().Meter(""))
close(finish)
}

Expand Down
7 changes: 4 additions & 3 deletions internal/global/meter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/noop"
)

func TestMeterProviderRace(t *testing.T) {
Expand All @@ -41,7 +42,7 @@ func TestMeterProviderRace(t *testing.T) {
}
}()

mp.setDelegate(metric.NewNoopMeterProvider())
mp.setDelegate(noop.NewMeterProvider())
close(finish)
}

Expand Down Expand Up @@ -84,7 +85,7 @@ func TestMeterRace(t *testing.T) {
}()

wg.Wait()
mtr.setDelegate(metric.NewNoopMeterProvider())
mtr.setDelegate(noop.NewMeterProvider())
close(finish)
}

Expand Down Expand Up @@ -113,7 +114,7 @@ func TestUnregisterRace(t *testing.T) {
_ = reg.Unregister()

wg.Wait()
mtr.setDelegate(metric.NewNoopMeterProvider())
mtr.setDelegate(noop.NewMeterProvider())
close(finish)
}

Expand Down
5 changes: 3 additions & 2 deletions internal/global/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/noop"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/trace"
)
Expand Down Expand Up @@ -152,7 +153,7 @@ func TestSetMeterProvider(t *testing.T) {
t.Run("First Set() should replace the delegate", func(t *testing.T) {
ResetForTest(t)

SetMeterProvider(metric.NewNoopMeterProvider())
SetMeterProvider(noop.NewMeterProvider())

_, ok := MeterProvider().(*meterProvider)
if ok {
Expand All @@ -165,7 +166,7 @@ func TestSetMeterProvider(t *testing.T) {

mp := MeterProvider()

SetMeterProvider(metric.NewNoopMeterProvider())
SetMeterProvider(noop.NewMeterProvider())

dmp := mp.(*meterProvider)

Expand Down
134 changes: 0 additions & 134 deletions metric/noop.go

This file was deleted.

2 changes: 1 addition & 1 deletion metric/example_test.go → metric/noop/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package metric_test
package noop_test

import (
"context"
Expand Down
Loading