How Elastic APM estimate SQL duraion

Hi
I ran Elastic APM agent with my Application that use jdbc to connect to database.

Now I compare top sql duration of Elastic APM agent and database log with below query on kibana:
service.target.type : "sqli" and span.duration.us > 2000000

surprisingly duration that "Elastic APM agent" show more than what i see on database log for each insert query!

e.g: for a same transaction APM tell 2 second while on database log show it take 0.01 !

FYI: database locate on another host that call "DB"

Any idea?
Thanks

From what i now of the inner workings of the APM it tracks the runtime of the JDBC Methods in the Java Programm.

That can probably also include a reconnect to the database if that is implemented in this way in the used JDBC Driver, which could explain the large difference.
Our APM SQL Query Duration Monitoring (against an Oracle DB) shows no such large differences.

So my guess would be it depends on the used JDBC Driver because the APM Agent is probably monitoring the runtime of the Statement.execute() Method in the JDBC Interface which is implemented differently in every driver. (I have not checked the instrumentation that is happening for this so there could be an instrumentation on something else.)

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