Class OtlpJsonEncoder
- All Implemented Interfaces:
LogEncoder
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, the key values selected
by keyValuesIncluded and keyValuesExcluded (all by default), and for a
throwable exception.type, exception.message, and
exception.stacktrace attributes. When the event has caller info it also carries
code.function.name, code.file.path, and code.line.number. Event
thread, caller, and exception attributes take precedence over key 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, and the key value
otel.event.name becomes the record's event name.
The include and exclude lists are case sensitive globs where * matches any
characters and ? matches one character. An excluded key is never added.
-
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
FieldsModifier and TypeFieldDescriptionstatic final StringDefault key value name holding the span id.static final StringDefault key value name holding the trace id.static final StringEncoder URI scheme.Fields inherited from interface LogEncoder
ENCODER_POST_PROCESSORS_PROPERTYModifier and TypeFieldDescriptionstatic final StringComma separated names of thepost processorsapplied, in the order listed, to an encoder backed by a formatter: "logging.appender.{name}.encoder.postProcessors". -
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.
-