Skip to content

exporter classes should be handle classes #202

@duncanpo

Description

@duncanpo

Some exporter classes (e.g. OtlpHttpSpanExporter) are currently implemented as value classes. However they contain handle properties which should not be shallow-copied. This can result in wrong and confusing behaviors.

import opentelemetry.sdk.trace.*
import opentelemetry.exporters.otlp.OtlpHttpSpanExporter
exp = OtlpHttpSpanExporter;                               % create an exporter
exp1 = exp;                                                           % make a copy
exp1.Endpoint = "bogus";                                    % mess up the endpoint of the copy
proc = SimpleSpanProcessor(exp);                      % use the original that supposedly be still using default settings
tp = TracerProvider(proc);                                    
tr = getTracer(tp, "foo");
sp = startSpan(tr, "bar");
endSpan(sp);

The above code will not export the span to the default collector location, because exp and exp1 still share the same backend even though they appear to be independent copies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions