Class TracingInterceptor
java.lang.Object
com.loomcache.server.tracing.TracingInterceptor
Intercepts cache protocol messages and instruments them with distributed tracing.
Responsibilities
- Create a root span for each incoming request - Extract and restore parent trace context from the message - Record span attributes: operation type, key, cache name, node role - Measure operation latency and record status - Record exceptions and errors - Automatically propagate trace context to downstream operations - Close span on responseAttributes Recorded
- http.method: operation type (GET, PUT, DELETE, etc.) - messaging.system: "loomcache" (fixed) - messaging.destination: cache name (map, queue, topic) - rpc.method: operation type - rpc.service: service name - client.address: client connection address - client.socket.address: client IP - network.peer.address: peer address - db.operation: operation type - db.cache_size: current cache size - error: true if operation failed - otel.status_code: OK, ERROR, or UNSETEvents Recorded
- operation_started: when message is received - operation_completed: when response is ready - operation_failed: when an exception occursUsage
TracingInterceptor interceptor = new TracingInterceptor(nodeId, instanceNumber);
Message request = Message.request(MessageType.MAP_GET)...;
Message response = interceptor.intercept(request, connectionContext);
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for message handlers. -
Constructor Summary
ConstructorsConstructorDescriptionTracingInterceptor(String nodeId, int instanceNumber) Create a new TracingInterceptor. -
Method Summary
Modifier and TypeMethodDescriptionintercept(Message message, ConnectionContext connectionContext, TracingInterceptor.MessageHandler handler) Intercept an incoming message and trace it.
-
Constructor Details
-
TracingInterceptor
Create a new TracingInterceptor.- Parameters:
nodeId- the node IDinstanceNumber- the instance number
-
-
Method Details
-
intercept
public Message intercept(Message message, ConnectionContext connectionContext, TracingInterceptor.MessageHandler handler) Intercept an incoming message and trace it. This method should be called by MessageHandler implementations to wrap the actual message handling with tracing instrumentation.- Parameters:
message- the incoming messageconnectionContext- the connection contexthandler- the actual message handler to call- Returns:
- the response message (may be null)
-