UNPKG

@opentelemetry/baggage-log-record-processor

Version:
39 lines 1.65 kB
import { BaggageKeyPredicate } from './types'; import { Context } from '@opentelemetry/api'; import { SdkLogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs'; /** * BaggageLogRecordProcessor is a {@link LogRecordProcessor} that reads entries stored in {@link Baggage} * from the parent context and adds the baggage entries' keys and * values to the log as attributes on log emit. * * ⚠ Warning ⚠️ * * Do not put sensitive information in Baggage. * * To repeat: a consequence of adding data to Baggage is that the keys and * values will appear in all outgoing HTTP headers from the application. */ export declare class BaggageLogRecordProcessor implements LogRecordProcessor { private _keyPredicate; /** * Constructs a new BaggageLogRecordProcessor instance. * @param keyPredicate A predicate that determines whether a baggage key-value pair should be added to new log as a log attribute. */ constructor(keyPredicate: BaggageKeyPredicate); /** * Forces to export all finished log records. */ forceFlush(): Promise<void>; /** * Called when a {@link SdkLogRecord} is emit * @param logRecord the ReadWriteLogRecord that just emitted. * @param context the current Context, or an empty Context if the Logger was obtained with include_trace_context=false */ onEmit(logRecord: SdkLogRecord, context?: Context): void; /** * Shuts down the processor. Called when SDK is shut down. This is an * opportunity for processor to do any cleanup required. */ shutdown(): Promise<void>; } //# sourceMappingURL=baggage-log-record-processor.d.ts.map