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

opentelemetry: on_event respects event's explicit parent #2296

Merged
merged 1 commit into from Sep 7, 2022

Conversation

wprzytula
Copy link
Contributor

One can want to have an event added from outside context of a span,
especially in an async code (e.g. between polls of the future, or
between polling multiple futures instrumented with that span). Then it
is expected that the event will be attached indeed to the span specified
as the parent and not the contextual one.
Fixes: #2295

Motivation

see #2295

Solution

see #2295

@wprzytula wprzytula requested review from jtescher and a team as code owners September 2, 2022 09:18
@jtescher jtescher added the crate/opentelemetry Related to the `tracing-opentelemetry` crate. label Sep 2, 2022
Copy link
Collaborator

@jtescher jtescher left a comment

Choose a reason for hiding this comment

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

Good fix, on_event should respect explicit event parents. Thanks @wprzytula

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

overall, this looks good! however, i had one small suggestion for how we could potentially simplify the code.

tracing-opentelemetry/src/layer.rs Outdated Show resolved Hide resolved
@hawkw hawkw changed the title layer: on_event respects event's explicit parent opentelemetry: on_event respects event's explicit parent Sep 2, 2022
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

@wprzytula would you mind changing this branch to target master rather than v0.1.x, so that the fix can land on the tracing 0.2 development branch? Maintainers will then handle backporting this change to v0.1.x and publishing a new tracing-opentelemetry version from that branch.

Thank you!

@wprzytula wprzytula changed the base branch from v0.1.x to master September 5, 2022 06:23
One can want to have an event added from outside context of a span,
especially in an async code (e.g. between polls of the future, or
between polling multiple futures instrumented with that span). Then it
is expected that the event will be attached indeed to the span specified
as the parent and not the contextual one.
@wprzytula wprzytula force-pushed the respect-event-parent branch 2 times, most recently from c64afe5 to 248ee2d Compare September 5, 2022 13:38
@wprzytula wprzytula requested review from hawkw and removed request for carllerche, yaahc and davidbarsky September 6, 2022 11:15
@wprzytula
Copy link
Contributor Author

@hawkw I followed your suggestions and the PR is ready.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

thanks, this looks good to me!

@hawkw hawkw merged commit 84633ea into tokio-rs:master Sep 7, 2022
@wprzytula wprzytula deleted the respect-event-parent branch September 8, 2022 06:12
@wprzytula
Copy link
Contributor Author

Any estimations when this fix gets backported to 0.1.x ? And btw, how will I know it's done?

@davidbarsky
Copy link
Member

davidbarsky commented Sep 8, 2022

Any estimations when this fix gets backported to 0.1.x ? And btw, how will I know it's done?

We typically do it whenever we do a release; I'm doing some backports right now and will ping you when it's ready.

davidbarsky pushed a commit that referenced this pull request Sep 8, 2022
…#2296)

One can want to have an event added from outside context of a span,
especially in an async code (e.g. between polls of the future, or
between polling multiple futures instrumented with that span). Then it
is expected that the event will be attached indeed to the span specified
as the parent and not the contextual one.

Fixes: #2295

See #2295
hawkw pushed a commit that referenced this pull request Sep 19, 2022
…#2296)

One can want to have an event added from outside context of a span,
especially in an async code (e.g. between polls of the future, or
between polling multiple futures instrumented with that span). Then it
is expected that the event will be attached indeed to the span specified
as the parent and not the contextual one.

Fixes: #2295

See #2295
hawkw pushed a commit that referenced this pull request Sep 19, 2022
…#2296)

One can want to have an event added from outside context of a span,
especially in an async code (e.g. between polls of the future, or
between polling multiple futures instrumented with that span). Then it
is expected that the event will be attached indeed to the span specified
as the parent and not the contextual one.

Fixes: #2295

See #2295
hawkw pushed a commit that referenced this pull request Sep 19, 2022
### Breaking Changes

- Upgrade to `v0.18.0` of `opentelemetry` (#2303)
  For list of breaking changes in OpenTelemetry, see the
  [v0.18.0 changelog](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/CHANGELOG.md#v0180).

### Fixed

- `on_event` respects event's explicit parent (#2296)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/opentelemetry Related to the `tracing-opentelemetry` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect events' parent in tracing-opentelemetry
4 participants