public static class NoOpSpanFactory.NoOpSpan extends Object implements Span
Span
implementation that does nothing.Modifier and Type | Field and Description |
---|---|
static NoOpSpanFactory.NoOpSpan |
INSTANCE
Instance of a
NoOpSpanFactory.NoOpSpan that can be used to avoid creating new instances. |
Constructor and Description |
---|
NoOpSpan() |
Modifier and Type | Method and Description |
---|---|
Span |
addAttribute(String key,
String value)
Adds an attribute to the span.
|
void |
end()
Ends the span.
|
SpanScope |
makeCurrent()
Sets the Span as the current for the current thread.
|
Span |
recordException(Throwable t)
Records an exception to the span.
|
Span |
start()
Starts the Span.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run, runCallable, runConsumer, runSupplier, wrapCallable, wrapConsumer, wrapRunnable, wrapSupplier
public static final NoOpSpanFactory.NoOpSpan INSTANCE
NoOpSpanFactory.NoOpSpan
that can be used to avoid creating new instances.public Span start()
Span
Span.makeCurrent()
in
order to do so.public SpanScope makeCurrent()
Span
SpanScope
must be closed before ending
the Span, on the same thread, or through a try-with-resources statement in the same thread as this method was
called.
You can make a span current on as many threads as you like, but you have to close every SpanScope
, or
context will leak into the current thread. Note that if this is neglected, the Span.end()
method should warn
the user in order to report this back to the framework.
makeCurrent
in interface Span
public void end()
Span
If scopes are still open when this method is called, either an exception should be thrown or an error log should be produced to warn the user of the leak. This information can then be reported back to the developers of the framework for a fix.
public Span recordException(Throwable t)
Span
recordException
in interface Span
t
- The exception to recordpublic Span addAttribute(String key, String value)
Span
addAttribute
in interface Span
key
- The key of the attribute.value
- The value of the attribute.Copyright © 2010–2024. All rights reserved.