Skip to content

java.lang.UnsupportedOperationException if trying to export logs from empty fileΒ #2378

@phansier

Description

@phansier

Describe the bug
LogRecordFromDiskExporter.exportStoredBatch() called periodically (once per 10 seconds) can read empty file and try to export it content.
But it throws java.lang.UnsupportedOperationException from inside of AttributesMapper with empty message.

Steps to reproduce
Same as SignalFromDiskExporter.kt#L69 in opentelemetry-android

What did you expect to see?
Probably it could ignore empty file and to not throw the exception.
Or add additional info into exception's message.

What did you see instead?
Stacktrace:

java.lang.UnsupportedOperationException
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.common.AttributesMapper.addValue(AttributesMapper.java:88)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.common.AttributesMapper.protoToAttributes(AttributesMapper.java:35)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.LogRecordDataMapper.addExtrasToSdkItemBuilder(LogRecordDataMapper.java:94)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.LogRecordDataMapper.mapToSdk(LogRecordDataMapper.java:84)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.ProtoLogsDataMapper.protoToSignalItem(ProtoLogsDataMapper.java:38)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.ProtoLogsDataMapper.protoToSignalItem(ProtoLogsDataMapper.java:20)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.common.BaseProtoSignalsDataMapper.fromProto(BaseProtoSignalsDataMapper.java:59)
   	at io.opentelemetry.contrib.disk.buffering.internal.serialization.deserializers.LogRecordDataDeserializer.deserialize(LogRecordDataDeserializer.java:28)
   	at io.opentelemetry.contrib.disk.buffering.internal.exporter.FromDiskExporterImpl.lambda$exportStoredBatch$0$io-opentelemetry-contrib-disk-buffering-internal-exporter-FromDiskExporterImpl(FromDiskExporterImpl.java:70)
   	at io.opentelemetry.contrib.disk.buffering.internal.exporter.FromDiskExporterImpl$$ExternalSyntheticLambda0.apply(D8$$SyntheticClass:0)
   	at io.opentelemetry.contrib.disk.buffering.internal.storage.files.ReadableFile.readAndProcess(ReadableFile.java:90)
   	at io.opentelemetry.contrib.disk.buffering.internal.storage.Storage.readAndProcess(Storage.java:120)
   	at io.opentelemetry.contrib.disk.buffering.internal.storage.Storage.readAndProcess(Storage.java:98)
   	at io.opentelemetry.contrib.disk.buffering.internal.exporter.FromDiskExporterImpl.exportStoredBatch(FromDiskExporterImpl.java:61)
   	at io.opentelemetry.contrib.disk.buffering.LogRecordFromDiskExporter.exportStoredBatch(LogRecordFromDiskExporter.java:37)

What version and what artifacts are you using?
Gradle, using opentelemetry-instrumentation-bom = "2.21.0"

Tip: React with πŸ‘ to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions