diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 03ae5e7e7..439e7819c 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -466,6 +467,20 @@ func TestNewViewAggregationErrorLogged(t *testing.T) { assert.Equal(t, 1, l.ErrorN()) } +func TestNewViewMultiInstMatchErrorLogged(t *testing.T) { + var got string + otel.SetLogger(funcr.New(func(_, args string) { + got = args + }, funcr.Options{Verbosity: 6})) + + _ = NewView(Instrument{ + Name: "*", // Wildcard match name (multiple instruments). + }, Stream{ + Name: "non-empty", + }) + assert.Contains(t, got, errMultiInst.Error()) +} + func ExampleNewView() { // Create a view that renames the "latency" instrument from the v0.34.0 // version of the "http" instrumentation library as "request.latency".