You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-25 22:41:46 +02:00
Deprecate Library and move all uses to Scope (#2977)
* Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * Update based on feedback * Revert change Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
This commit is contained in:
@@ -74,7 +74,7 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} {
|
||||
// instrumentation so it can trace operational flow through a system.
|
||||
type TracerProvider struct {
|
||||
mu sync.Mutex
|
||||
namedTracer map[instrumentation.Library]*tracer
|
||||
namedTracer map[instrumentation.Scope]*tracer
|
||||
spanProcessors atomic.Value
|
||||
|
||||
// These fields are not protected by the lock mu. They are assumed to be
|
||||
@@ -110,7 +110,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider {
|
||||
o = ensureValidTracerProviderConfig(o)
|
||||
|
||||
tp := &TracerProvider{
|
||||
namedTracer: make(map[instrumentation.Library]*tracer),
|
||||
namedTracer: make(map[instrumentation.Scope]*tracer),
|
||||
sampler: o.sampler,
|
||||
idGenerator: o.idGenerator,
|
||||
spanLimits: o.spanLimits,
|
||||
@@ -141,18 +141,18 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
|
||||
if name == "" {
|
||||
name = defaultTracerName
|
||||
}
|
||||
il := instrumentation.Library{
|
||||
is := instrumentation.Scope{
|
||||
Name: name,
|
||||
Version: c.InstrumentationVersion(),
|
||||
SchemaURL: c.SchemaURL(),
|
||||
}
|
||||
t, ok := p.namedTracer[il]
|
||||
t, ok := p.namedTracer[is]
|
||||
if !ok {
|
||||
t = &tracer{
|
||||
provider: p,
|
||||
instrumentationLibrary: il,
|
||||
provider: p,
|
||||
instrumentationScope: is,
|
||||
}
|
||||
p.namedTracer[il] = t
|
||||
p.namedTracer[is] = t
|
||||
global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL())
|
||||
}
|
||||
return t
|
||||
|
||||
Reference in New Issue
Block a user