08 Nov 2022 12:56 AM - last edited on 14 Nov 2022 08:34 AM by MaciejNeumann
Hello, I'm trying to hit an API that will return the response time of my top X database statements by response time. Im using the accept:text/csv header, and would like to see the response time and request count returned in separate columns for each X database statement for a given a period of time.
Solved! Go to Solution.
10 Nov 2022 11:50 AM
Hi, you can combine boths calls in a single API call but it won't output a single array with two dimensions. You have to process them afterwards.
see example:
/api/v2/metrics/query?metricSelector=(builtin:service.response.time:splitBy():sort(value(auto,descending)):limit(100)):limit(100):names,(builtin:service.requestCount.total:splitBy():sort(value(auto,descending)):limit(100)):limit(100):names&from=-2h&to=now&api-token=XXXXXXXXXXXXX
10 Nov 2022 01:24 PM
Thank you for your reply, this is very helpful. How do I add the database statements do the call so I can map them to the values?
10 Nov 2022 01:45 PM
Database statements metrics are not available out of the box for each statement. It's the same as for webservice request/operation at webservice level.
Statements must be marked as key requests before (see below)
Then the related metrics that you can use are
builtin:service.keyRequest.count.total for request count
builtin:service.keyRequest.response.time for response time
you can filter by key request identifier which is "SERVICE_METHOD-XXXXXXX" you can find in the url of the screenshot above.