Debian Codegraph @

exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package tracetransform
5
6 import (
7 "testing"
8
9 "github.com/stretchr/testify/assert"
10 commonpb "go.opentelemetry.io/proto/otlp/common/v1"
11
12 "go.opentelemetry.io/otel/attribute"
13 "go.opentelemetry.io/otel/sdk/instrumentation"
14 )
15
16 func TestInstrumentationScope(t *testing.T) {
17 want := &commonpb.InstrumentationScope{
18 Name: "name",
19 Version: "1.0.0",
20 Attributes: []*commonpb.KeyValue{
21 {
22 Key: "foo",
23 Value: &commonpb.AnyValue{
24 Value: &commonpb.AnyValue_StringValue{StringValue: "bar"},
25 },
26 },
27 },
28 }
29
30 in := instrumentation.Scope{
31 Name: "name",
32 Version: "1.0.0",
33 Attributes: attribute.NewSet(attribute.String("foo", "bar")),
34 }
35
36 got := InstrumentationScope(in)
37
38 assert.Equal(t, want, got)
39 }