Class SimpleLogRecordProcessor
- All Implemented Interfaces:
LogRecordProcessor,Closeable,AutoCloseable
LogRecordProcessor that passes LogRecordData directly to
the configured exporter.
This processor will cause all logs to be exported directly as they finish, meaning each export
request will have a single log. Most backends will not perform well with a single log per request
so unless you know what you're doing, strongly consider using BatchLogRecordProcessor
instead, including in special environments such as serverless runtimes. SimpleLogRecordProcessor is generally meant to for testing only.
- Since:
- 1.27.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic LogRecordProcessorcreate(LogRecordExporter exporter) Returns a newSimpleLogRecordProcessorwhich exports logs to theLogRecordExportersynchronously.io.opentelemetry.sdk.common.CompletableResultCodeProcess all log records that have not yet been processed.Return the processor's configuredLogRecordExporter.voidonEmit(io.opentelemetry.context.Context context, ReadWriteLogRecord logRecord) Called when aLoggerLogRecordBuilder.emit()s a log record.io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Shutdown the log processor.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
-
Method Details
-
create
Returns a newSimpleLogRecordProcessorwhich exports logs to theLogRecordExportersynchronously.This processor will cause all logs to be exported directly as they finish, meaning each export request will have a single log. Most backends will not perform well with a single log per request so unless you know what you're doing, strongly consider using
BatchLogRecordProcessorinstead, including in special environments such as serverless runtimes.SimpleLogRecordProcessoris generally meant to for testing only. -
onEmit
Description copied from interface:LogRecordProcessorCalled when aLoggerLogRecordBuilder.emit()s a log record.- Specified by:
onEmitin interfaceLogRecordProcessor- Parameters:
context- the context set viaLogRecordBuilder.setContext(Context), orContext.current()if not explicitly setlogRecord- the log record
-
shutdown
public io.opentelemetry.sdk.common.CompletableResultCode shutdown()Description copied from interface:LogRecordProcessorShutdown the log processor.- Specified by:
shutdownin interfaceLogRecordProcessor- Returns:
- result
-
forceFlush
public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()Description copied from interface:LogRecordProcessorProcess all log records that have not yet been processed.- Specified by:
forceFlushin interfaceLogRecordProcessor- Returns:
- result
-
getLogRecordExporter
Return the processor's configuredLogRecordExporter.- Since:
- 1.37.0
-
toString
-