-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Spans do not have the parent child relationship when created using the decorator : @tracer.start_as_current_span() #35042
Comments
Thanks for reaching out. Could you share the information which Azure service and Azure SDK do you use? |
Hi @summahto. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
Azure SDK used : Azure Services used : Here are the dependencies which we are using for our FastAPI application:
|
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jeremydvoss @lzchen. |
This seems to be an issue related to the opentelemetry sdk and not specifically azure monitor. Please open up an issue in the opentelemetry repository. |
All right. Can we link the 2 issues once I have created the issue in opentelemetry repository. Issue created in opentelemetry repository : open-telemetry/opentelemetry-python#3832 |
Please use the one in open-telemetry repo to track the issue. |
Describe the bug
Different behavior is seen in Application Insights when a span is created with and without a decorator.
To Reproduce
Steps to reproduce the behavior:
Here is the sample code :
CASE 1:
CASE 2:
Expected behavior
Behavior should be the same in both the CASES 1 and 2. The correct one being the spans seen in CASE 1. Attached the screenshots for the spans as visualized in Application Insights in the following section.
According to Opentelemetry's documentation Create-span-using-decorator :
Creating spans with decorators
It’s common to have a single span track the execution of an entire function. In that scenario, there is a decorator you can use to reduce code:
Use of the decorator is equivalent to creating the span inside do_work() and ending it when do_work() is finished.
To use the decorator, you must have a tracer instance available global to your function declaration. Based on this definition
of how tracer decorator should create spans, the behavior of CASE1 and CASE2 should be the same.
Screenshots
Spans seen in Application Insights CASE1 (which is fine and expected) :
Spans seen in Application Insights CASE2 (which is wrong and should be the same as CASE 1 ) :
The text was updated successfully, but these errors were encountered: