Class BaggageLogRecordProcessor
java.lang.Object
io.opentelemetry.contrib.baggage.processor.BaggageLogRecordProcessor
- All Implemented Interfaces:
io.opentelemetry.sdk.logs.LogRecordProcessor,Closeable,AutoCloseable
public final class BaggageLogRecordProcessor
extends Object
implements io.opentelemetry.sdk.logs.LogRecordProcessor
This log record processor copies attributes stored in
Baggage into each newly created log
record.-
Constructor Summary
ConstructorsConstructorDescriptionBaggageLogRecordProcessor(Collection<String> included, Collection<String> excluded) Creates a newBaggageLogRecordProcessorthat copies baggage entries with keys that pass the provided include/exclude filtering into the newly created log record, when both arguments are null or empty all baggage are included.BaggageLogRecordProcessor(Predicate<String> baggageKeyPredicate) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic BaggageLogRecordProcessorCreates a newBaggageLogRecordProcessorthat copies all baggage entries into the newly created log record.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
-
Constructor Details
-
BaggageLogRecordProcessor
Deprecated.UseBaggageLogRecordProcessor(Collection, Collection)instead. Most usages of this method should be replaceable with glob patterns, but not all thus this method is kept to preserve compatibility. -
BaggageLogRecordProcessor
public BaggageLogRecordProcessor(@Nullable Collection<String> included, @Nullable Collection<String> excluded) Creates a newBaggageLogRecordProcessorthat copies baggage entries with keys that pass the provided include/exclude filtering into the newly created log record, when both arguments are null or empty all baggage are included.- Parameters:
included- list of included baggage key patterns to includeexcluded- list of excluded baggage key patterns to exclude
-
-
Method Details
-
allowAllBaggageKeys
Creates a newBaggageLogRecordProcessorthat copies all baggage entries into the newly created log record.- Returns:
- baggage log processor including all attributes
-
onEmit
public void onEmit(io.opentelemetry.context.Context context, io.opentelemetry.sdk.logs.ReadWriteLogRecord logRecord) - Specified by:
onEmitin interfaceio.opentelemetry.sdk.logs.LogRecordProcessor
-
toString
-
BaggageLogRecordProcessor(Collection, Collection)instead.