Class OtlpJsonEncoder
java.lang.Object
io.jstach.rainbowgum.LogEncoder.AbstractEncoder<JsonBuffer>
io.jstach.rainbowgum.otlp.OtlpJsonEncoder
- All Implemented Interfaces:
LogEncoder
Encodes each event as one line of OTLP/JSON: a complete
LogsData object holding
a single log record. This is the OpenTelemetry file format, read by the OpenTelemetry
Collector's otlpjsonfile receiver or by the filelog receiver with the
otlpjson connector, so it needs no network connection.
Each record carries the formatted message as its body, the logger name as its
instrumentation scope, thread.name, thread.id, every key value, and for
a throwable exception.type, exception.message, and
exception.stacktrace attributes. Event thread and exception attributes take
precedence over context values with the same names. Key values named by
traceIdKey and spanIdKey (default traceId and spanId,
as Micrometer Tracing puts them in the MDC) become the record's trace context when they
are valid W3C ids.
-
Nested Class Summary
Nested classes/interfaces inherited from interface LogEncoder
LogEncoder.AbstractEncoder<T>, LogEncoder.Buffer, LogEncoder.BufferHints, LogEncoder.Builder, LogEncoder.EncoderProviderModifier and TypeInterfaceDescriptionstatic classLogEncoder.AbstractEncoder<T extends LogEncoder.Buffer>Abstract encoder that will cast the buffer to the desired implementation.static interfaceEncoders buffer.static interfaceHints the output can pass to the encoder for creating buffers like max size and storage style of the buffer etc.static final classBuilds aLogEncoderout of aLogFormatter.static interfaceFinds output based on URI. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic LogProvider<OtlpJsonEncoder> of(Consumer<OtlpJsonEncoderBuilder> consumer) Creates the encoder with a builder lambda; properties are applied after the lambda.Methods inherited from class LogEncoder.AbstractEncoder
buffer, encodeModifier and TypeMethodDescriptionfinal LogEncoder.Bufferbuffer(LogEncoder.BufferHints hints) Creates a new buffer.final voidencode(LogEvent event, LogEncoder.Buffer buffer) Encodes an event to the buffer.
-
Field Details
-
OTLP_SCHEME
-
DEFAULT_TRACE_ID_KEY
Default key value name holding the trace id.- See Also:
-
DEFAULT_SPAN_ID_KEY
Default key value name holding the span id.- See Also:
-
-
Method Details
-
of
Creates the encoder with a builder lambda; properties are applied after the lambda.- Parameters:
consumer- configures the builder.- Returns:
- encoder provider.
-