-
Notifications
You must be signed in to change notification settings - Fork 720
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
misc. backports #1361
Merged
Merged
misc. backports #1361
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Motivation Understand the overhead added by recording OpenTelemetry data so that it can be minimized. ## Solution Add criterion benchmarks, initially tracking request/response style workloads (1 main span with 99 children). This patch adds benchmarks for standard `tracing-opentelemetry` usage, as well as baselines for understanding the overhead specific to the usage of the otel tracer, and registry span access patterns.
* subscriber: fix span data for new, exit, and close events New, exit and close span events are generated while the current context is set to either `None` or the parent span of the span the event relates to. This causes spans data to be absent from the JSON output in the case of the `None`, or causes the span data to reference the parent's span data. Changing the way the current span is determined allows the correct span to be identified for these events. Trying to access the events `.parent()` allows access of the correct span for the `on_event` actions, while using `.current_span()` works for normal events. Ref: #1032 * Fix style * subscriber: improve test for #1333 Based on feedback by @hawkw, I've improved the test for #1333 to parse the json output. This is more specifc for the bug and allows easier testing of the different span `on_events`. Ref: #1333 (review) * subscriber: improve #1334 tests covering all span states Use the `on_records` test method check all events have the correct context as described in the PR. * Apply suggestions from code review Co-authored-by: Eliza Weisman <eliza@buoyant.io>
The following two patterns for the `event!()` are identical to each other, and the second one swapped the order of `$lvl` and `parent: $parent` which I don't think is correct. ```rust (parent: $parent:expr, $lvl:expr, { $($fields:tt)* }, $($arg:tt)+ ) => ( $crate::event!( target: module_path!(), parent: $parent, $lvl, { message = format_args!($($arg)+), $($fields)* } ) ); (parent: $parent:expr, $lvl:expr, { $($fields:tt)* }, $($arg:tt)+ ) => ( $crate::event!( target: module_path!(), $lvl, parent: $parent, { message = format_args!($($arg)+), $($fields)* } ) ); ``` I found the duplicated via [macro_railraod](https://github.com/lukaslueg/macro_railroad). Here is the diagram: ![image](https://user-images.githubusercontent.com/3369694/114296705-47ec8700-9adf-11eb-971f-f485329d0339.png)
## Motivation Allow users to set custom span status codes and messages to follow opentelemetry semantic conventions. ## Solution Support the status code and status message fields in `OpenTelemetrySubscriber` Proposal to close #1346
jtescher
approved these changes
Apr 16, 2021
hawkw
force-pushed
the
eliza/backport-a-bunch-fstuff
branch
2 times, most recently
from
April 16, 2021 21:44
d45b6c5
to
e2f7324
Compare
## Motivation Currently, the default `Compact` and `Full` formatters in `tracing-subscriber` will prefix log lines with a single space when timestamps are disabled. The space is emitted in order to pad the timestamp from the rest of the log line, but it shouldn't be emitted when timestamps are turned off. This should be fixed. ## Solution This branch fixes the issue by skipping `time::write` entirely when timestamps are disabled. This is done by tracking an additional boolean flag for disabling timestamps. Incidentally, this now means that span lifecycle timing can be enabled even if event timestamps are disabled, like this: ```rust use tracing_subscriber::fmt; let subscriber = fmt::subscriber() .without_time() .with_timer(SystemTime::now) .with_span_events(fmt::FmtSpan::FULL); ``` or similar. I also added a new test reproducing the issue, and did a little refactoring to try and clean up the timestamp formatting code a bit. Closes #1354
## Motivation Exposing an accessor for the `FieldSet` on `Attributes` can motivate the subscriber to achieve some performance improvement, such as `OpenTelemetrySubscriber` #1327. ## Alternative Make `ValueSet::field_set()` be `pub` instead of `pub(crate)`. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
hawkw
force-pushed
the
eliza/backport-a-bunch-fstuff
branch
from
April 16, 2021 23:59
e2f7324
to
34b0bd8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cherry-picks a number of recent commits from
master
to v0.1.x:FieldSet
onAttributes
(core: expose an accessor for theFieldSet
onAttributes
#1331)event!()
macro pattern #1352)