Closed summahto closed 2 months ago
Can you confirm what opentelemetry-api and opentelemetry-sdk version you are using? The sounds related to https://github.com/open-telemetry/opentelemetry-python/issues/3270 which was just fixed in the latest release by https://github.com/open-telemetry/opentelemetry-python/pull/3633. Can you try with the latest v1.24.0 packages?
Can you confirm what opentelemetry-api and opentelemetry-sdk version you are using?
Following is the versions of above packages :
name = "opentelemetry-api" version = "1.23.0"
name = "opentelemetry-sdk" version = "1.23.0"
Let me try the new version(1.24) and confirm
@aabmass ,
I checked it in the latest version that is (v1.24.0) and it works as expected. I can see the parent child relationship between spans when using the decorator as shown in CASE 2 as well. Thanks for the support.
Steps to reproduce
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 ) :