Package io.opentelemetry.sdk.logs.export
Class InMemoryLogRecordExporter
java.lang.Object
io.opentelemetry.sdk.logs.export.InMemoryLogRecordExporter
- All Implemented Interfaces:
LogRecordExporter,Closeable,AutoCloseable
A
LogRecordExporter implementation that can be used to test OpenTelemetry integration.-
Method Summary
Modifier and TypeMethodDescriptionstatic InMemoryLogRecordExportercreate()Returns a new instance of theInMemoryLogRecordExporter.io.opentelemetry.sdk.common.CompletableResultCodeexport(Collection<LogRecordData> logs) Exports the collection ofLogs into the inmemory queue.io.opentelemetry.sdk.common.CompletableResultCodeflush()Exports the collection ofLogRecordDatathat have not yet been exported.Returns aListof the finishedLogs, represented byLogRecord.voidreset()Clears the internalListof finishedLogs.io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Clears the internalListof finishedLogs.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.opentelemetry.sdk.logs.export.LogRecordExporter
close
-
Method Details
-
create
Returns a new instance of theInMemoryLogRecordExporter.- Returns:
- a new instance of the
InMemoryLogRecordExporter.
-
getFinishedLogItems
Returns aListof the finishedLogs, represented byLogRecord.- Returns:
- a
Listof the finishedLogs.
-
reset
public void reset()Clears the internalListof finishedLogs.Does not reset the state of this exporter if already shutdown.
-
export
Exports the collection ofLogs into the inmemory queue.If this is called after
shutdown, this will returnResultCode.FAILURE.- Specified by:
exportin interfaceLogRecordExporter- Parameters:
logs- the collection ofLogRecordDatato be exported- Returns:
- the result of the export, which is often an asynchronous operation
-
flush
public io.opentelemetry.sdk.common.CompletableResultCode flush()Description copied from interface:LogRecordExporterExports the collection ofLogRecordDatathat have not yet been exported.- Specified by:
flushin interfaceLogRecordExporter- Returns:
- the result of the flush, which is often an asynchronous operation
-
shutdown
public io.opentelemetry.sdk.common.CompletableResultCode shutdown()Clears the internalListof finishedLogs.Any subsequent call to export() function on this exporter, will return
CompletableResultCode.ofFailure()- Specified by:
shutdownin interfaceLogRecordExporter- Returns:
- a
CompletableResultCodewhich is completed when shutdown completes
-