Class EventToSpanEventBridge
java.lang.Object
io.opentelemetry.sdk.extension.incubator.logs.EventToSpanEventBridge
- All Implemented Interfaces:
io.opentelemetry.sdk.logs.LogRecordProcessor,Closeable,AutoCloseable
public final class EventToSpanEventBridge
extends Object
implements io.opentelemetry.sdk.logs.LogRecordProcessor
A
LogRecordProcessor which bridges events (i.e. log records with a non-empty
event.name) as span events on the current span.
A log record is bridged to a span event if and only if all of the following conditions are met:
- The log record has a non-empty event name.
- The log record has a valid trace ID and span ID.
- The resolved context contains a current span whose
Span.isRecording()istrue. - The log record's trace ID and span ID equal those of the current span in the resolved context.
When bridged, a span event is added with:
- Name set to the log record's event name.
- Timestamp set to the log record's timestamp if set; otherwise, the observed timestamp.
- All log record attributes copied to the span event attributes.
Bridging does NOT prevent the log record from continuing through the normal log processing pipeline.
-
Method Summary
Modifier and TypeMethodDescriptionstatic EventToSpanEventBridgecreate()Create a new instance.voidonEmit(io.opentelemetry.context.Context context, io.opentelemetry.sdk.logs.ReadWriteLogRecord logRecord) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.opentelemetry.sdk.logs.LogRecordProcessor
close, forceFlush, shutdown