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

Set end time during on_exit instead of during `on_close #116

Closed
mladedav opened this issue Mar 11, 2024 · 1 comment · Fixed by #124
Closed

Set end time during on_exit instead of during `on_close #116

mladedav opened this issue Mar 11, 2024 · 1 comment · Fixed by #124

Comments

@mladedav
Copy link
Contributor

Feature Request

Motivation

Currently, the open telemetry span is considered to be running until the tracing span is dropped and closed. This can be an issue in cases where either the span is held onto in case the operation needs more processing which was not known beforehand or when a structure holds onto the span.

More specifically, this can happen for example with JoinHandle<T> which points to a spawned instrumented task. Even though the task has finished as long as we hold the handle, the span will exist and end time will be sent only when the handle is dropped.

Proposal

Set the time on each on_exit, overwriting the value on each exit. The last value will be used when the span is closed, built, and sent.

Alternatives

The user can manage dropping the spans themself, but then they sometimes cannot use instrument() and some other useful utilities.

@mladedav
Copy link
Contributor Author

mladedav commented Apr 1, 2024

This also prevents us from having children spans that are open longer than their parent.

tracing closes spans only after all their children have been also closed so that they have access to the parent and its extensions.

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 a pull request may close this issue.

1 participant