Describe the bug
The ReadWriteLogRecord.getObservedTimestampEpochNanos() default method returns the record timestamp instead of the observed timestamp.
Steps to reproduce
Implement ReadWriteLogRecord by providing only the abstract methods (setAttribute, toLogRecordData) and relying on the interface default methods, with a LogRecordData whose timestamp and observed timestamp differ. Call getObservedTimestampEpochNanos().
What did you expect to see?
getObservedTimestampEpochNanos() returns the observed timestamp, like the SDK override SdkReadWriteLogRecord (line 146-147), which returns the observedTimestampEpochNanos field.
What did you see instead?
It returns the record timestamp. The default at ReadWriteLogRecord.getObservedTimestampEpochNanos() (sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java line 99-101) calls toLogRecordData().getTimestampEpochNanos() instead of getObservedTimestampEpochNanos(). The sibling default getTimestampEpochNanos() (line 90-92) is correct, and LogRecordData exposes both getters separately (line 36, line 39). The copy-paste slip arrived with the default getters in #6924. Because SdkReadWriteLogRecord overrides the getter, the SDK pipeline is unaffected; only third-party implementations relying on the defaults get the wrong value.
What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-logs
Version: main @ 824334c
How did you reference these artifacts? N/A
Environment
Compiler: Temurin 21
OS: N/A
Additional context
N/A
Describe the bug
The
ReadWriteLogRecord.getObservedTimestampEpochNanos()default method returns the record timestamp instead of the observed timestamp.Steps to reproduce
Implement
ReadWriteLogRecordby providing only the abstract methods (setAttribute,toLogRecordData) and relying on the interface default methods, with aLogRecordDatawhose timestamp and observed timestamp differ. CallgetObservedTimestampEpochNanos().What did you expect to see?
getObservedTimestampEpochNanos()returns the observed timestamp, like the SDK overrideSdkReadWriteLogRecord(line 146-147), which returns theobservedTimestampEpochNanosfield.What did you see instead?
It returns the record timestamp. The default at
ReadWriteLogRecord.getObservedTimestampEpochNanos()(sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.javaline 99-101) callstoLogRecordData().getTimestampEpochNanos()instead ofgetObservedTimestampEpochNanos(). The sibling defaultgetTimestampEpochNanos()(line 90-92) is correct, andLogRecordDataexposes both getters separately (line 36, line 39). The copy-paste slip arrived with the default getters in #6924. BecauseSdkReadWriteLogRecordoverrides the getter, the SDK pipeline is unaffected; only third-party implementations relying on the defaults get the wrong value.What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-logs
Version: main @ 824334c
How did you reference these artifacts? N/A
Environment
Compiler: Temurin 21
OS: N/A
Additional context
N/A