You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
Add test for multi-inst view error (#4308)
This commit is contained in:
@@ -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".
|
||||
|
||||
Reference in New Issue
Block a user