Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LogRecord observed timestamp field #5370

Merged
merged 1 commit into from
Apr 15, 2023

Conversation

jack-berg
Copy link
Member

The log data model differentiates between timestamp and observed timestamp.

Timestamp is the time at which the log occurred. Observed timestamp is the time at which the log was recorded in the collection system.

Timestamp is different than observed timestamp if the logs are being processed asynchronously. For example, maybe the logs are being read from a file, or are being processed on a different thread than where they occur. These will be very frequently the same for the SDK, but occasionally they will be different.

We could wait to add setters in the API until users request it, but we really should minimally be including getters on LogRecordData, and we really should populate the LogRecord#observed_time_unix_nano when serializing OTLP payloads.

IMO, we might as well go all the way and add the API setters.

@jack-berg jack-berg requested a review from a team April 11, 2023 15:44
Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

This looks good to me. While I can't imagine that there are huge numbers of use cases for this field in the java side of things, it's best to have the api match the spec for completeness.

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (8f6f9e7) 91.20% compared to head (b873381) 91.23%.

❗ Current head b873381 differs from pull request most recent head 679c034. Consider uploading reports for the commit 679c034 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5370      +/-   ##
============================================
+ Coverage     91.20%   91.23%   +0.02%     
- Complexity     4876     4882       +6     
============================================
  Files           549      549              
  Lines         14402    14425      +23     
  Branches       1352     1354       +2     
============================================
+ Hits          13136    13160      +24     
  Misses          877      877              
+ Partials        389      388       -1     
Impacted Files Coverage Δ
...va/io/opentelemetry/api/logs/LogRecordBuilder.java 60.00% <ø> (ø)
...va/io/opentelemetry/sdk/logs/SdkLogRecordData.java 100.00% <ø> (ø)
.../java/io/opentelemetry/api/logs/DefaultLogger.java 100.00% <100.00%> (ø)
...metry/sdk/testing/assertj/LogRecordDataAssert.java 100.00% <100.00%> (ø)
...ntelemetry/sdk/testing/logs/TestLogRecordData.java 100.00% <100.00%> (ø)
...io/opentelemetry/sdk/logs/SdkLogRecordBuilder.java 98.00% <100.00%> (+0.38%) ⬆️
.../opentelemetry/sdk/logs/SdkReadWriteLogRecord.java 93.75% <100.00%> (+0.20%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jack-berg jack-berg merged commit bce7d96 into open-telemetry:main Apr 15, 2023
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.

4 participants