1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Add instrumentation scope attributes (#3131)

* Add WithScopeAttributes TracerOption to trace API

* Add Attributes field to instrumentation Scope

* Use scope attributes for new Tracer

* Fix stdouttrace expected test output

* Allow unexported Set fields in sdk/trace test

* Export instrumentation scope attrs in OTLP

* Add changes to the changelog

* Fix imports with make lint

* Add unit tests for WithScopeAttributes

* Fix English in Scope documentation
This commit is contained in:
Tyler Yahn
2022-08-31 15:19:50 -07:00
committed by GitHub
parent 454d57b720
commit 0078faeb0e
9 changed files with 126 additions and 9 deletions

View File

@@ -211,6 +211,7 @@ func TestTracerConfig(t *testing.T) {
v1 := "semver:0.0.1"
v2 := "semver:1.0.0"
schemaURL := "https://opentelemetry.io/schemas/1.2.0"
one, two := attribute.Int("key", 1), attribute.Int("key", 2)
tests := []struct {
options []TracerOption
expected TracerConfig
@@ -246,6 +247,24 @@ func TestTracerConfig(t *testing.T) {
schemaURL: schemaURL,
},
},
{
[]TracerOption{
WithScopeAttributes(one, two),
},
TracerConfig{
attributes: attribute.NewSet(two),
},
},
{
[]TracerOption{
WithScopeAttributes(two),
WithScopeAttributes(one),
},
TracerConfig{
attributes: attribute.NewSet(one),
},
},
}
for _, test := range tests {
config := NewTracerConfig(test.options...)