-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #247 +/- ##
=======================================
+ Coverage 48.0% 49.5% +1.5%
=======================================
Files 60 60
Lines 8576 8760 +184
=======================================
+ Hits 4121 4342 +221
+ Misses 4455 4418 -37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @cijothomas . I reworked the PR using the feedback provided. Errors are Boxed and simplified things. Please review. |
opentelemetry-etw-logs/Cargo.toml
Outdated
@@ -11,15 +11,19 @@ keywords = ["opentelemetry", "log", "trace", "etw"] | |||
license = "Apache-2.0" | |||
|
|||
[dependencies] | |||
tracelogging_dynamic = "1.2.4" | |||
chrono = { version = "0.4.40", default-features = false, features = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its hard to tell if this file actually has changes or not..looks like just re-arranging ? please remove unrelated changes from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't trim this PR further. Please, accept this PR as is. Subsequent ones should be small, incremental changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't follow. Does this file actually have any changes or just re-arranging the order?
Its putting unnecessary burden on reviewers to closely check and confirm if this is actually changed or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is a limitation of the diff tool and how git works. At this time, is only reordering.
The project does not have a toml formatting, causing this kind of inconsistencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its putting unnecessary burden on reviewers to closely check and confirm if this is actually changed or not.
I’m with @cijothomas on this. Simplifying the PR for review not only helps reviewers but also benefits the author by increasing the chances of a quicker merge. In this case, the only intended change appears to be the removal of microbench
from the dev dependencies. Ideally, that should have been the sole modification, without reordering the other dependencies.
The project does not have a toml formatting, causing this kind of inconsistencies.
It’s usually a good idea to stick to the existing style, formatting, or conventions used in the project when sending in PRs. If there doesn’t seem to be a clear standard yet, it might be better to open a separate PR to introduce one, rather than mixing style changes into an unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it may help to have smaller targeted PRs, but at the same time, there has been a lot of back and forth in design and decisions that makes it difficult to track in smaller PRs at this moment.
We added more deps on this PR initially, then we removed some of them. That, in combination with leaving the files better than before, led to the changes as you see today. For me, this is a motto: leave everything better than was before. I know this can be noisier to review, but the idea is to pay this cost once (now), than in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally fine with the idea of improving everything, but please do it only in own, separate PRs.
/// | ||
/// The resulting name must be a valid CommonSchema 4.0 TraceLoggingDynamic event name. Otherwise, | ||
/// the default "Log" ETW event name will be used. | ||
pub fn etw_event_name_from_callback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the discussion here : #275 (comment)
We need to decide how best to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that discussion. I propose we merge this PR without releasing a version yet. Once we agree upon a design, we change in both etw and ue exporters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a TODO or something to indicate this needs to be discussed further. Okay to merge with this.
use tracing_subscriber::prelude::*; | ||
|
||
let processor = Processor::builder("provider-name") | ||
.etw_event_name_from_callback(|_| "CustomEvent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure what is the validation this test is doing? I see "CustomEvent" is returned, but there is no validation.. Is this test just to ensure no panic etc. occurs? Please add a small comment so its easy to tell the intent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an integration test at this moment. Renamed to tracing_integration_test
. We can move it to the tests
folder (we should create it) if you prefer, either on this PR or a new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment was more about - "There are not asserts in the test, so what is the purpose of the test"?
.etw_event_name_from_callback(|log_record| log_record.event_name().unwrap_or_default()); | ||
|
||
let result = options.get_etw_event_name(&log_record); | ||
assert_eq!(result, "Log"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting that "Log" is still the name, though the callback is always returning something... Is this trying to test that invalid_event_name_from_callback_will_use_default
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not surprising, the name initially is empty, thus the validation, in its current basic form, fails and default to "Log".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. It's better to have a targeted test for the same. invalid_event_name_from_callback_will_use_default
would be my suggestion.
Not a blocker.
let result = options.get_etw_event_name(&log_record); | ||
assert_eq!(result, "Log"); | ||
|
||
log_record.set_target("target-name"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if we pass empty string to target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on the callback given. Assuming the callback is returning the target, the current validation will discard it because it is empty and return the default "Log".
} | ||
|
||
#[test] | ||
fn test_get_event_name_from_callback_returning_target() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what are these tests trying to test. For the callback, we just take the name from the callback - does it matter where/how the callback is returning the value from? It can do it from event_name or target or static.. doesn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #
Design discussion issue (if applicable) #
Changes
Changing from a trait extension to a LogProcessor factory.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes