Skip to content

Commit

Permalink
Revert "Revert "Move metric No-Op to metric/noop (open-telemetry#3893)…
Browse files Browse the repository at this point in the history
…" (open-telemetry#3921)"

This reverts commit 795ad97.
  • Loading branch information
MrAlias committed Mar 27, 2023
1 parent ae90c44 commit 04bc9e6
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 218 deletions.
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`. (#TBD)
- `NewNoopMeterProvider` is replaced with `noop.NewMeterProvider`

## [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

0 comments on commit 04bc9e6

Please sign in to comment.