Seeing periods of seemingly no activity in APM monitoring using Django

We've been trying out APM with Django today, and so far are quite happy with the results. However, we're seeing traces having large periods of time, where nothing is seemingly happening (at least, no data is being collected?).

It seems to happen quite frequently across all of our traces, both if we run locally, and if we run through uWSGI on actual servers.

Attached is an example of a trace that clearly shows a very large gap of no data. Is this a known issue, or maybe a misconfiguration on our end? Or are we maybe even reading the trace wrong?

Hi Henrik

thanks for giving it a spin, great to hear that you like it!

Do you have any hunch what your code might be doing between that SQL query and the HTTP request? It's possible that it does something expensive that we do not instrument.

The way we profile your code is that we instrument certain functions and methods that are generally considered to be potentially slow (mostly things doing IO: database queries, HTTP requests, that sort of thing). While this method of profiling generates much less overhead than something like CProfiler (which basically instruments every line of code), we can only measure what we actively instrument.

If your code happens to do something expensive that we don't instrument, you can end up with these gaps. This can be custom code, or a library/database that we don't support yet.

If you do have a hunch what your code could be doing in that gap, you can try and use our elasticapm.trace decorator/context-manager: https://www.elastic.co/guide/en/apm/agent/python/1.x/instrumenting-custom-code.html (note that elasticapm.trace will be renamed to elasticapm.capture_span in version 2 of the agent, which will be released together with the Elastic Stack 6.2 Real Soon Now™)

Cheers,
Beni

Hi,

Right, that makes sense. I guess we're used to other APM solutions more or less just having a large chunk of "Other" shown, which (in my opinion) makes the timeline easier to follow - and less confusion when you have a large gap like here. It does, however, make sense once you explain it!

Thank you for your point on custom instrumentation. It is something we've done a lot with our other APM solution, but haven't changed for this test-spin of Elastic APM :slight_smile:

Slowly trying it out on more of our in-house products, it sure does seem like we might be able to scrap our previous APM solution. Will likely make a general feedback thread once I've had some more time to fiddle with the data!

Thanks,
Henrik
Coolshop.com

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.