-
Notifications
You must be signed in to change notification settings - Fork 649
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
Make tracer.start_as_current_span()
decorator work with async functions
#3633
Make tracer.start_as_current_span()
decorator work with async functions
#3633
Conversation
11c51cb
to
fd9d30a
Compare
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 for the back and forth here. I want to get @ocelotl's thoughts and consider moving back to the original approach
5d03fd0
to
ab942de
Compare
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.
Thanks!
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.
We need a comment that explains why we are using a private attribute.
PS: I still don't really understand how |
@QuentinN42 the current CI failure "metrics/integration_test/test_console_exporter.py - TypeError: 'ABCMeta... is not subscritable" I think can be solved by quoting the type annotations |
I've added some code from contextlib in this commit acd649d to allow the linter to know that we are returning a import opentelemetry.trace
TRACER = opentelemetry.trace.get_tracer(__name__)
with TRACER.start_as_current_span("foo") as span:
print(span.get_span_context().trace_id) |
I've also added comment on the tricky typing part with relevant python versions. |
I've applied all asked changes and also merged |
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
…trace api Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
…Manager class Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
9bcd349
to
c49f8c2
Compare
The missing symbol error was caused by a rebase on main and subsequent force push by me, sorry.
Marking it as draft to prevent accidental merging. @QuentinN42 please check that this PR is ok, I have mistakenly force pushed changes that may have affected it, apologies for the mistake. |
Just checked right now with my local branch. All seems good 👍 |
Thanks! |
…ator-work-with-async-functions
@ocelotl When can we expect a new version of |
Description
Fixing the
start_as_current_span
decorator that report near zero time for spans of decorated async functions.Fixes #3270
Type of change
Please delete options that are not relevant.
Tracer
class can still use thecontextlib
decorator (but it will still be bugged for them), as soon as they implement it, it must be working fine on their end two.How Has This Been Tested?
opentelemetry-api/tests/trace/test_tracer.py
: Created the minimal reproduction and fixed it.Does This PR Require a Contrib Repo Change?
Checklist: