ReadWriteLogRecord default getEventName() always returns null

Open Beginner friendly
#8,840 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start with sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java at getEventName() on line 61, and compare it with the other default getters that delegate to toLogRecordData(). Done means an implementation using only the two abstract methods receives the event name returned by its LogRecordData; run the relevant sdk/logs tests and add coverage for that case.

Written by the indexing model from the issue text.

Description

Describe the bug
ReadWriteLogRecord.getEventName() has a default implementation that always returns null, even when toLogRecordData().getEventName() returns a value. Every other default getter on the interface (getAttributes(), getSeverity(), getObservedTimestampEpochNanos(), ...) delegates to toLogRecordData().

Steps to reproduce
Implement ReadWriteLogRecord with only the two abstract methods (setAttribute() and toLogRecordData()), return a LogRecordData whose getEventName() is "my.event", then call getEventName() on the record.

What did you expect to see?
"my.event", consistent with the Javadoc ("Returns the log record event name, or null if none is set") and with the other default getters on the same interface.

What did you see instead?
null. ReadWriteLogRecord.getEventName() (sdk/logs/src/main/java/io/opentelemetry/sdk/logs/ReadWriteLogRecord.java line 61) returns null unconditionally. The SDK's own SdkReadWriteLogRecord is unaffected because it overrides the method.

Same shape as #8501, where the default getObservedTimestampEpochNanos() returned the wrong field and was fixed in #8504.

What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-logs
Version: main @ 509182e4b (present since 1.50.0, #7277)
How did you reference these artifacts? N/A

Environment
Compiler: Temurin 21
OS: N/A

Additional context
N/A

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 16h
Merged PRs (30d)
53

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.