Skip to content

Conversation

@dshkil
Copy link

@dshkil dshkil commented Dec 17, 2025

Description:

Bug fix - LogRecord with a body equal to an empty string cannot be mapped to an SDK's Value. It happens on periodic export in the background and causes an unhandled exception.

In this case, AnyValue deserialized using protobuf has all its fields set to null. It makes impossible to determine the original body value type. However, according to LogRecordDataMapper.bodyToAnyValue(), the only possible non-null values are strings.
I suppose the root cause is related to the LogRecord protobuf schema. However, changes to the schema could be problematic, and we also need a workaround for existing data.

java.lang.IllegalArgumentException: Unrecognized AnyValue type
	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.LogRecordDataMapper.anyValueToBody(LogRecordDataMapper.java:139)
	at io.opentelemetry.contrib.disk.buffering.internal.serialization.mapping.logs.LogRecordDataMapper.mapToSdk(LogRecordDataMapper.java:81)
	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:27)
	at io.opentelemetry.contrib.disk.buffering.internal.storage.Storage.doReadNext(Storage.java:123)
	at io.opentelemetry.contrib.disk.buffering.internal.storage.Storage.readNext(Storage.java:94)
	at io.opentelemetry.contrib.disk.buffering.internal.storage.StorageIterator.findNext(StorageIterator.java:80)
	at io.opentelemetry.contrib.disk.buffering.internal.storage.StorageIterator.hasNext(StorageIterator.java:41)
	at io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter.export(SignalFromDiskExporter.kt:73)
	at io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter.exportBatchOfLogs(SignalFromDiskExporter.kt:65)
	at io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter.exportBatchOfEach(SignalFromDiskExporter.kt:96)
	at io.opentelemetry.android.features.diskbuffering.scheduler.DefaultExportScheduler.onRun(DefaultExportScheduler.kt:31)
	at io.opentelemetry.android.internal.services.periodicwork.PeriodicRunnable.run(PeriodicRunnable.kt:24)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

Existing Issue(s):

#2530

Testing:

Tested in the app

Documentation:

No functional changes

Outstanding items:

No functional changes

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 17, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: dshkil / name: Dmytro Shkil (1ce95d0)

@dshkil dshkil marked this pull request as ready for review December 17, 2025 21:22
@dshkil dshkil requested a review from a team as a code owner December 17, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant