Package org.atmosphere.metrics
Class AtmosphereTracing
java.lang.Object
org.atmosphere.cpr.AtmosphereInterceptorAdapter
org.atmosphere.metrics.AtmosphereTracing
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware,InvokationOrder
OpenTelemetry tracing interceptor for Atmosphere requests.
Creates a trace span for each incoming request covering the full
lifecycle from inspect through to disconnect. Requires
io.opentelemetry:opentelemetry-api on the classpath (optional dependency).
Usage
OpenTelemetry otel = GlobalOpenTelemetry.get(); // or your configured instance
framework.interceptor(new AtmosphereTracing(otel));
Span attributes
atmosphere.resource.uuid— the resource UUIDatmosphere.transport— transport type (WEBSOCKET, SSE, etc.)atmosphere.action— the action result (CONTINUE, SUSPEND, etc.)atmosphere.broadcaster— the broadcaster IDatmosphere.disconnect.reason— reason for disconnect (if applicable)
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.atmosphere.interceptor.InvokationOrder
InvokationOrder.PRIORITY -
Field Summary
Fields inherited from interface org.atmosphere.interceptor.InvokationOrder
AFTER_DEFAULT, BEFORE_DEFAULT, FIRST_BEFORE_DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionAtmosphereTracing(io.opentelemetry.api.OpenTelemetry openTelemetry) Create tracing interceptor with the given OpenTelemetry instance.AtmosphereTracing(io.opentelemetry.api.trace.Tracer tracer) Create tracing interceptor with a custom tracer. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.Invoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.voidInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.io.opentelemetry.api.trace.SpanstartRoomSpan(String operation, String roomName, String uuid) Create a span for a room operation (join, leave, broadcast).toString()Methods inherited from class org.atmosphere.cpr.AtmosphereInterceptorAdapter
destroy, priority
-
Constructor Details
-
AtmosphereTracing
public AtmosphereTracing(io.opentelemetry.api.OpenTelemetry openTelemetry) Create tracing interceptor with the given OpenTelemetry instance.- Parameters:
openTelemetry- the OpenTelemetry instance
-
AtmosphereTracing
public AtmosphereTracing(io.opentelemetry.api.trace.Tracer tracer) Create tracing interceptor with a custom tracer.- Parameters:
tracer- the OpenTelemetry tracer
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Overrides:
configurein classAtmosphereInterceptorAdapter- Parameters:
config-AtmosphereConfig
-
inspect
Description copied from interface:AtmosphereInterceptorInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
inspectin interfaceAtmosphereInterceptor- Overrides:
inspectin classAtmosphereInterceptorAdapter- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUEorAction.SUSPENDto dispatch theAtmosphereResourceto otherAtmosphereInterceptororAtmosphereHandler. ReturnAction.TYPE.CANCELLEDto stop the processing.
-
postInspect
Description copied from interface:AtmosphereInterceptorInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
postInspectin interfaceAtmosphereInterceptor- Overrides:
postInspectin classAtmosphereInterceptorAdapter- Parameters:
r- aAtmosphereResource
-
startRoomSpan
public io.opentelemetry.api.trace.Span startRoomSpan(String operation, String roomName, String uuid) Create a span for a room operation (join, leave, broadcast).- Parameters:
operation- the operation name (e.g., "join", "leave", "broadcast")roomName- the room nameuuid- the resource UUID- Returns:
- the span (caller must call
span.end())
-
toString
- Overrides:
toStringin classAtmosphereInterceptorAdapter
-