1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-06-25 00:16:49 +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

@ -142,9 +142,10 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
name = defaultTracerName
}
is := instrumentation.Scope{
Name: name,
Version: c.InstrumentationVersion(),
SchemaURL: c.SchemaURL(),
Name: name,
Version: c.InstrumentationVersion(),
SchemaURL: c.SchemaURL(),
Attributes: c.Attributes(),
}
t, ok := p.namedTracer[is]
if !ok {
@ -153,7 +154,13 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
instrumentationScope: is,
}
p.namedTracer[is] = t
global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL())
global.Info(
"Tracer created",
"name", name,
"version", c.InstrumentationVersion(),
"schemaURL", c.SchemaURL(),
"attributes", c.Attributes(),
)
}
return t
}