#support

Issue with Signoz Tracer on Python FastAPI Application

TLDR Snehanshu is experiencing an issue with the Signoz tracer on a Python FastAPI application which involves a large number of irrelevant spans. vishal-signoz suggested verifying the relevance of these spans and questioned about the type of instrumentation used by Snehanshu.

Powered by Struct AI
Aug 17, 2023 (1 month ago)
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
04:24 AM
Hi team, when I am using Signoz tracer to monitor a method in my Python FastAPI application which involves jpype library, there is huge numbr of traces coming up on the UI and also the UI hangs on opening up that particular request. Could anyone help me know why this is happening?
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:10 AM
How many spans are there?
The community edition supports upto 10k spans in a single trace. The enterprise plan has a feature which allows upto 100k spans in a single trace.
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:31 AM
vishal-signoz 2998 spans coming up. However i have attached traces only to few methods. These many spans showing up when jpype is used.
Other cases only the required number of spans show up.
Is it normal behaviour or something is wrong from my code end?
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:32 AM
Can you check if the spans are relevant?
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:33 AM
No they are not relevant. they have time spans of 0.01 microseconds.
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:33 AM
Our enterprise customers do have thousands of spans so depends on your system.
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:33 AM
Outside of the main span which is actually required.
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:36 AM
Are they duplicates? Can you their name and attributes?
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:36 AM
If you see this screenshot, the upload span is the only required span, however the POST/ ones are in huge number coming up.
Image 1 for If you see this screenshot, the upload span is the only required span, however the POST/ ones are in huge number coming up.
07:36
Snehanshu
07:36 AM
Yes they are duplicates the POST/ ones
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:38 AM
I didn’t find any relevant github issues on jpype. How did you instrument?
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:39 AM
from opentelemetry import trace
tracer = trace.gettracer(_name)
with tracer.start_as_current_span("file_response"):
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
07:39 AM
So you are manually instrumenting?
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:39 AM
Yes within each method which i want to be monitored. Usig this.
with tracer.start_as_current_span("file_response"):
07:41
Snehanshu
07:41 AM
There is a nested method calls which comes up perfectly as in the screenshot marked with 7, upload.
07:41
Snehanshu
07:41 AM
However i am not able to get why those extra POST spans are showing up.
08:02
Snehanshu
08:02 AM
Also FYI, the API is being run by the command:
OTEL_RESOURCE_ATTRIBUTES=service.name=autofill_exports OTEL_EXPORTER_OTLP_ENDPOINT="endpoint" opentelemetry-instrument <followed by the api command>
vishal-signoz
Photo of md5-f936d3e5743d23344d6c60813189716f
vishal-signoz
09:04 AM
Any reason why you are not using auto instrumentation?
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
09:44 AM
When using auto instrumentation i was not getting spans for individual methods.
09:44
Snehanshu
09:44 AM
Or could you point me to any correct resource?
09:45
Snehanshu
09:45 AM
using auto instrumentation?
09:53
Snehanshu
09:53 AM
https://signoz.io/docs/instrumentation/python/
on following this page i was getting only the endpoint span, and this was too in large number. This did not give the spans for the methods it was calling internally.
Aug 20, 2023 (1 month ago)
Snehanshu
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Snehanshu
07:32 AM
vishal-signoz if you could answer this?