Package io.opentelemetry.sdk.logs.export
Class InMemoryLogExporter
java.lang.Object
io.opentelemetry.sdk.logs.export.InMemoryLogExporter
- All Implemented Interfaces:
LogExporter
A
LogExporter implementation that can be used to test OpenTelemetry integration.-
Method Summary
Modifier and TypeMethodDescriptionstatic InMemoryLogExportercreate()Returns a new instance of theInMemoryLogExporter.io.opentelemetry.sdk.common.CompletableResultCodeexport(Collection<LogData> logs) Exports the collection ofLogs into the inmemory queue.io.opentelemetry.sdk.common.CompletableResultCodeflush()Exports the collection ofLogDatathat 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.
-
Method Details
-
create
Returns a new instance of theInMemoryLogExporter.- Returns:
- a new instance of the
InMemoryLogExporter.
-
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 interfaceLogExporter- Parameters:
logs- the collection ofLogDatato 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:LogExporterExports the collection ofLogDatathat have not yet been exported.- Specified by:
flushin interfaceLogExporter- 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 LogExporter, will return
CompletableResultCode.ofFailure()- Specified by:
shutdownin interfaceLogExporter- Returns:
- a
CompletableResultCodewhich is completed when shutdown completes
-