@Stability.Volatile public interface RequestSpan
Note that you'll most likely consume this interface through actual implementations from the tracer module that is used for your application. You will not need to worry about this with the default threshold request tracer, but if you are using OpenTracing or OpenTelemetry, look in their respective modules for implementations of this class.
Modifier and Type | Interface and Description |
---|---|
static class |
RequestSpan.StatusCode
Provides an abstraction over underlying tracing status codes.
|
Modifier and Type | Method and Description |
---|---|
void |
attribute(String key,
boolean value)
Sets a high-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
void |
attribute(String key,
long value)
Sets a high-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
void |
attribute(String key,
String value)
Sets a high-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
void |
end()
Completes this span.
|
void |
event(String name,
Instant timestamp)
Sets an event on the span, which is translated to the corresponding implementation specific event.
|
default void |
lowCardinalityAttribute(String key,
boolean value)
Sets a low-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
default void |
lowCardinalityAttribute(String key,
long value)
Sets a low-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
default void |
lowCardinalityAttribute(String key,
String value)
Sets a low-cardinality attribute on the span, which is translated to the corresponding implementation specific tag.
|
default void |
recordException(Throwable err)
Records that an exception happened on the span.
|
void |
requestContext(RequestContext requestContext)
Allows to set a request context to the request span.
|
void |
status(RequestSpan.StatusCode status)
Sets the status of the span, which is by default UNSET.
|
void attribute(String key, String value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.void attribute(String key, boolean value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.void attribute(String key, long value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.@Stability.Internal default void lowCardinalityAttribute(String key, String value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.@Stability.Internal default void lowCardinalityAttribute(String key, boolean value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.@Stability.Internal default void lowCardinalityAttribute(String key, long value)
Note that, depending on the implementation, attributes might be ignored.
key
- the key of the attribute.value
- the value of the attribute.void event(String name, Instant timestamp)
Note that, depending on the implementation, events might be ignored.
name
- the name of the eventtimestamp
- the timestamp when it happened.void status(RequestSpan.StatusCode status)
Note that, depending on the implementation, this might be a no-op.
status
- the span's new status.@Stability.Volatile default void recordException(Throwable err)
The span still needs to have `span.end()` called. And the application may want to set the status to StatusCode.ERROR. Neither is done automatically, since it's possible for a span to have an exception but then recover.
err
- the exception to record.void end()
@Stability.Internal void requestContext(RequestContext requestContext)
requestContext
- the request context, if present.Copyright © 2024 Couchbase, Inc.. All rights reserved.