cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to monitor slow queries and discover the code (and line) that originated this query?

rafael_pires
Newcomer

Is there a way I can monitor slow queries on the database and discover which code originated this slow query?

I can see some queries on the Database section and get some information from PurePath on Transactions and Services, but I can't seem to find a way to know where the query was generated, like a complete stacktrace that shows which files (and which line) generated this query (I'm running a PHP application).

Is it possible to discover that with Dynatrace?

4 REPLIES 4

The_AM
Dynatrace Champion
Dynatrace Champion

Hi Rafael,

This should be possible by performing a "Service Backtrace" within Dynatrace. See more on that here: https://www.dynatrace.com/support/help/shortlink/service-backtrace and here: https://www.dynatrace.com/support/help/shortlink/database-services#database-service-backtrace

More on how Dynatrace detects the database activity here: https://www.dynatrace.com/support/help/shortlink/database-detection


As your question relates to our Dynatrace SaaS and Managed offerings, I'll move this question to the appropriate forum. (Because "AppMon & UEM Q&A" relates to one of our classic products.)

Regards,
Andrew M.

Regards,
Andrew M.

AntonioSousa
DynaMight Guru
DynaMight Guru

In Dynatrace you don't get it at the Purepath level, even when seen in "Code level". But given that PHP is (normally) interpreted, it might be possible. So probably this might be better considered an RFE.

It's a different case in errors, where that information is available:

Antonio Sousa

Anonymous
Not applicable

Actually, you can do something similar, wont give you the exact line of code, but you can see purepath:


or an overall of all the calls and add a filter for calls to an specific DB and specific response time:


From there you can see the callstack or even download the source. The only thing that wont showup is the code line i think.


fstekelenburg
DynaMight Pro
DynaMight Pro

Nowadays you should also be able to get all the database queries and their response times and other metrics, from the database details under Database. If the information displayed is not specific enough, you can create your own multidimensional analysis views, and save them for the service.

fstekelenburg_0-1686924513149.png

create your own multidimensional analysis views, and save:

DB mda resp time.PNG



Kind regards, Frans Stekelenburg                 Certified Dynatrace Associate | measure.works, Dynatrace Partner

Featured Posts