Skip to content

Commit

Permalink
Make OtelSpan publicly accessible (#809)
Browse files Browse the repository at this point in the history
Fixes gh-808

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
  • Loading branch information
ThomasVitale authored Sep 19, 2024
1 parent e0f7c41 commit 65e2c9e
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,36 @@
* @author Marcin Grzejszczak
* @since 1.0.0
*/
class OtelSpan implements Span {
public class OtelSpan implements Span {

final io.opentelemetry.api.trace.Span delegate;

final OtelTraceContext otelTraceContext;

OtelSpan(io.opentelemetry.api.trace.Span delegate) {
public OtelSpan(io.opentelemetry.api.trace.Span delegate) {
this.delegate = delegate;
this.otelTraceContext = new OtelTraceContext(delegate.getSpanContext(), delegate);
}

OtelSpan(io.opentelemetry.api.trace.Span delegate, Context context) {
public OtelSpan(io.opentelemetry.api.trace.Span delegate, Context context) {
this.delegate = delegate;
this.otelTraceContext = new OtelTraceContext(context, delegate.getSpanContext(), delegate);
}

OtelSpan(OtelTraceContext traceContext) {
public OtelSpan(OtelTraceContext traceContext) {
this.delegate = traceContext.span != null ? traceContext.span : io.opentelemetry.api.trace.Span.current();
this.otelTraceContext = traceContext;
}

static io.opentelemetry.api.trace.Span toOtel(Span span) {
public static io.opentelemetry.api.trace.Span toOtel(Span span) {
return ((OtelSpan) span).delegate;
}

static Span fromOtel(io.opentelemetry.api.trace.Span span) {
public static Span fromOtel(io.opentelemetry.api.trace.Span span) {
return new OtelSpan(span);
}

static Span fromOtel(io.opentelemetry.api.trace.Span span, Context context) {
public static Span fromOtel(io.opentelemetry.api.trace.Span span, Context context) {
return new OtelSpan(span, context);
}

Expand Down

0 comments on commit 65e2c9e

Please sign in to comment.