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

adds timestamps #2231

Conversation

montekki
Copy link

Fixes #
Design discussion issue (if applicable) #

Changes

Unset timestamps in logs break services such as Quickwit, although if my understanding is correct these timestamps must be set as a part of OTEL spec.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@montekki montekki requested a review from a team as a code owner October 23, 2024 08:31
Copy link

linux-foundation-easycla bot commented Oct 23, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.1%. Comparing base (ea4b5e4) to head (91a5cf9).
Report is 94 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2231   +/-   ##
=====================================
  Coverage   79.1%   79.1%           
=====================================
  Files        121     121           
  Lines      21082   21173   +91     
=====================================
+ Hits       16680   16762   +82     
- Misses      4402    4411    +9     

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

@@ -173,6 +173,8 @@ where
log_record.set_event_name(meta.name());
log_record.set_severity_number(severity_of_level(meta.level()));
log_record.set_severity_text(meta.level().as_str());
log_record.set_timestamp(std::time::SystemTime::now());
Copy link
Member

Choose a reason for hiding this comment

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

As per the specs - This field is optional, it may be missing if the source timestamp is unknown.

@@ -173,6 +173,8 @@ where
log_record.set_event_name(meta.name());
log_record.set_severity_number(severity_of_level(meta.level()));
log_record.set_severity_text(meta.level().as_str());
log_record.set_timestamp(std::time::SystemTime::now());
log_record.set_observed_timestamp(std::time::SystemTime::now());
Copy link
Member

@lalitb lalitb Oct 23, 2024

Choose a reason for hiding this comment

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

This is already done in SDK, why do we need it here?

Copy link
Author

@montekki montekki Oct 23, 2024

Choose a reason for hiding this comment

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

Is this path in SDK hit when this Bridge is added as a layer into tracing_subscriber ? On the QuickWit side I see that this timestamp was not populated which needed a workaround: quickwit-oss/quickwit#5366
However this fix is not ideal since it will set the log timestamp at the received time, not at the emit time which will lead to all sorts of troubles.

Copy link
Member

@lalitb lalitb Oct 23, 2024

Choose a reason for hiding this comment

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

Is this path in SDK hit when this Bridge is added as a layer into tracing_subscriber

yes it does. You can try running the example to verify - https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-appender-tracing/examples/basic.rs

@lalitb
Copy link
Member

lalitb commented Oct 23, 2024

timestamp setting is costly (ref - #2046), let's not do it unless really required by specs.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

As discussed in PR.

@cijothomas
Copy link
Member

@montekki I am closing this PR as it looks like there is no missing functionality. If you believe otherwise, we can re-open to discuss more.

@cijothomas cijothomas closed this Dec 2, 2024
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.

3 participants