com.lightstep.tracer.shared.NoopSpan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
The LightStep OpenTracing Tracer implementation for Java
package com.lightstep.tracer.shared;
import java.util.Collections;
import java.util.Map;
import io.opentracing.Span;
import io.opentracing.SpanContext;
// A span which is returned when the tracer is disabled.
class NoopSpan implements Span {
static final Span INSTANCE = new NoopSpan();
private static final SpanContext CONTEXT = new NoopSpanContext();
private NoopSpan() {}
@Override
public SpanContext context() {
return CONTEXT;
}
@Override
public void finish() {}
@Override
public void finish(long timestamp) {}
@Override
public Span setTag(String key, String value) {
return this;
}
@Override
public Span setTag(String key, boolean value) {
return this;
}
@Override
public Span setTag(String key, Number value) {
return this;
}
@Override
public Span setTag(io.opentracing.tag.Tag tag, T value) {
return this;
}
@Override
public Span log(String message) {
return this;
}
@Override
public Span log(long timestampMicroseconds, String message) {
return this;
}
@Override
public final Span log(Map fields) {
return this;
}
@Override
public final Span log(long timestampMicros, Map fields) {
return this;
}
@Override
public String getBaggageItem(String key) {
return null;
}
@Override
public Span setBaggageItem(String key, String value) {
return this;
}
public Span setOperationName(String operationName) {
return this;
}
private static class NoopSpanContext implements SpanContext {
@Override
public Iterable> baggageItems() {
return Collections.emptySet();
}
@Override
public String toTraceId() {
return "";
}
@Override
public String toSpanId() {
return "";
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy