Package com.tnsai.quality.observability
Class OpenTelemetryTracer.SpanScope
java.lang.Object
com.tnsai.quality.observability.OpenTelemetryTracer.SpanScope
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
OpenTelemetryTracer
A scope wrapper for OpenTelemetry spans that implements AutoCloseable.
Provides a fluent API for adding attributes and setting status.
-
Method Summary
Modifier and TypeMethodDescriptionAdds an event to the span.Adds an event with attributes to the span.voidclose()io.opentelemetry.api.trace.SpangetSpan()Gets the underlying OpenTelemetry Span.setAttribute(String key, boolean value) Sets a boolean attribute on the span.setAttribute(String key, double value) Sets a double attribute on the span.setAttribute(String key, long value) Sets a long attribute on the span.setAttribute(String key, String value) Sets a string attribute on the span.setAttributes(Map<String, ?> attributes) Sets multiple attributes from a map.Marks the span as failed with a message.Marks the span as failed with an exception.Marks the span as successful.
-
Method Details
-
getSpan
public io.opentelemetry.api.trace.Span getSpan()Gets the underlying OpenTelemetry Span. -
setAttribute
Sets a string attribute on the span. -
setAttribute
Sets a long attribute on the span. -
setAttribute
Sets a double attribute on the span. -
setAttribute
Sets a boolean attribute on the span. -
setAttributes
Sets multiple attributes from a map. -
addEvent
Adds an event to the span. -
addEvent
Adds an event with attributes to the span. -
setSuccess
Marks the span as successful. -
setError
Marks the span as failed with a message. -
setError
Marks the span as failed with an exception. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-