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 Details

    • BaggageLogRecordProcessor

      @Deprecated public BaggageLogRecordProcessor(Predicate<String> baggageKeyPredicate)
      Deprecated.
      Use BaggageLogRecordProcessor(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 new BaggageLogRecordProcessor that 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 include
      excluded - list of excluded baggage key patterns to exclude
  • Method Details

    • allowAllBaggageKeys

      public static BaggageLogRecordProcessor allowAllBaggageKeys()
      Creates a new BaggageLogRecordProcessor that 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:
      onEmit in interface io.opentelemetry.sdk.logs.LogRecordProcessor
    • toString

      public String toString()
      Overrides:
      toString in class Object