Skip to content

docs(logs): clarify setTimestamp javadoc for event timestamp behavior#8104

Merged
jack-berg merged 4 commits intoopen-telemetry:mainfrom
ruturajjadhav07:fix/settimestamp-javadoc
Mar 3, 2026
Merged

docs(logs): clarify setTimestamp javadoc for event timestamp behavior#8104
jack-berg merged 4 commits intoopen-telemetry:mainfrom
ruturajjadhav07:fix/settimestamp-javadoc

Conversation

@ruturajjadhav07
Copy link
Contributor

Summary

The Javadoc for LogRecordBuilder#setTimestamp previously stated:

"If unset, it will be set to the current time when emit() is called."

This is incorrect: the implementation only provides a default value for the observed timestamp,
not for the event timestamp.

This PR updates the Javadoc to clarify that:

  • Unset event timestamps are NOT automatically populated when emit() is called.
  • Only the observed timestamp receives a default value.

Related Issue

Fixes #8097


Type of Change

  • Documentation update
  • Bug fix
  • Code change

@ruturajjadhav07 ruturajjadhav07 requested a review from a team as a code owner February 19, 2026 15:50
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 19, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

…er.java

Co-authored-by: Jack Berg <34418638+jack-berg@users.noreply.github.com>
* <p>The {@code timestamp} is the time at which the log record occurred. If unset, it will be set
* to the current time when {@link #emit()} is called.
* <p>Note: If the event timestamp is unset, it will NOT be automatically populated when
* {@link #emit()} is called. Only the observed timestamp receives a default value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply the note change here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply the note change here as well

Updated as suggested. Thank you!

@jkwatson
Copy link
Contributor

Looks like there are some checkstyle problems still.

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.35%. Comparing base (0b0929e) to head (794d6ea).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8104      +/-   ##
============================================
+ Coverage     90.32%   90.35%   +0.03%     
- Complexity     7607     7644      +37     
============================================
  Files           839      841       +2     
  Lines         22888    23002     +114     
  Branches       2283     2293      +10     
============================================
+ Hits          20673    20783     +110     
  Misses         1506     1506              
- Partials        709      713       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jack-berg jack-berg merged commit e2a8362 into open-telemetry:main Mar 3, 2026
27 checks passed
@otelbot
Copy link
Contributor

otelbot bot commented Mar 3, 2026

Thank you for your contribution @ruturajjadhav07! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

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.

SdkLogRecordBuilder does not properly set default timestamp

3 participants