Skip to content

feat: stabilization of opentelemetry-etw-logs #247

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

Open
wants to merge 70 commits into
base: main
Choose a base branch
from

Conversation

psandana
Copy link
Contributor

Fixes #
Design discussion issue (if applicable) #

Changes

Please provide a brief description of the changes here.

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)

@psandana psandana requested a review from a team as a code owner April 11, 2025 21:03
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 97.31183% with 10 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@7a2634f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
opentelemetry-etw-logs/src/logs/processor.rs 97.5% 4 Missing ⚠️
...pentelemetry-etw-logs/src/logs/exporter/options.rs 98.2% 3 Missing ⚠️
stress/src/etw_logs.rs 0.0% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main    #247   +/-   ##
======================================
  Coverage        ?   52.5%           
======================================
  Files           ?      64           
  Lines           ?    8737           
  Branches        ?       0           
======================================
  Hits            ?    4593           
  Misses          ?    4144           
  Partials        ?       0           

☔ 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.

@psandana psandana changed the title feat: Use "Log" as default event name feat: Add "Log" as default event name Apr 22, 2025
@psandana psandana changed the title feat: Add "Log" as default event name feat: Event mapping support on target attribute Apr 22, 2025

#[test]
fn log_with_etw_exporter_trait() {
use log::{error, Level};
Copy link
Member

Choose a reason for hiding this comment

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

why test log here specifically? Exporters should have no connection to the logging library anyway right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, and for that we should use the LogRecord interface directly. But as we decided to not do so, and use tracing, I also feel we should explicitly test the integration of log crate for parity.

Copy link
Member

Choose a reason for hiding this comment

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

please make those changes in separate PR to keep the scope in control. This is already touching too many aspects in one PR.


/// Options used by the Exporter.
#[derive(Debug)]
pub struct ExporterOptions {
Copy link
Member

Choose a reason for hiding this comment

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

@lalitb @utpilla
Would love to get more feedback on this approach.
One downside with this approach is that, users will most likely need to write LogRecordProcessor to customize Name,Target as their defaults may not work well. (i.e the default name, target provided by tracing is not likely useful)

Other option is to expose a callback for end-users, in the exporter.
get_etw_event_name(&log_record) -> &str
This has the upside that users can return the name without having to replace the original name (and target), so PartB.Log.name will always contain the original EventName, and users can influence PartA-name (and Table names in backend). This does have a risk of letting arbitrary user code run in the hot path. Given the alternative is to write LogRecordProcessor, which is also arbitrary user-code, we could reconsider (@psandana yes, I known I was not very supportive of providing arbitrary callbacks, but considering the full picture, I can change my position) this approach.

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