How to obtain Key Request reponse time and count via the DT API?

I want to extract response time and count metrics for specific Key Request and am not clear whether this can be done via the API.

When I query the metrics available in the v2 API I see none that relate to Key Requests.

https://<ENV REFERENCE>/api/v2/metrics?Api-Token=<TOKEN>

Via DT chat, I was told that the following metrics should be available… I am not clear why I do not see them listed in the call above. I am also unclear what is meant by “client” and “server” in this context… do either of these provide the same info as would be shown as “Response Time” when showing a Key Request in the Key Request chart type of a dashboard? Is there a metric to get the request count?

builtin:service.keyRequest.response.server
builtin:service.keyRequest.response.client

Use this as metric selector:

builtin:service.keyRequest.*

These are results:

{<br>  "totalCount": 28,<br>  "nextPageKey": null,<br>  "metrics": [<br>    {<br>      "metricId": "builtin:service.keyRequest.count.client",<br>      "displayName": "Request count - client",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.count.server",<br>      "displayName": "Request count - server",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.count.total",<br>      "displayName": "Request count",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.cpu.perRequest",<br>      "displayName": "CPU per request",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.cpu.time",<br>      "displayName": "Service method CPU time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.dbChildCallCount",<br>      "displayName": "Number of calls to databases",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.dbChildCallTime",<br>      "displayName": "Time spent in database calls",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.client.count",<br>      "displayName": "Number of client side errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.client.rate",<br>      "displayName": "Failure rate (client side  errors)",<br>      "description": "",<br>      "unit": "Percent"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.client.successCount",<br>      "displayName": "Number of calls without  client side errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fivexx.count",<br>      "displayName": "Number of HTTP 5xx errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fivexx.rate",<br>      "displayName": "Failure rate (HTTP 5xx  errors)",<br>      "description": "",<br>      "unit": "Percent"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fivexx.successCount",<br>      "displayName": "Number of calls without  HTTP 5xx errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fourxx.count",<br>      "displayName": "Number of HTTP 4xx errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fourxx.rate",<br>      "displayName": "Failure rate (HTTP 4xx  errors)",<br>      "description": "",<br>      "unit": "Percent"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.fourxx.successCount",<br>      "displayName": "Number of calls without  HTTP 4xx errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.server.count",<br>      "displayName": "Number of server side errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.server.rate",<br>      "displayName": "Failure rate (server side  errors)",<br>      "description": "",<br>      "unit": "Percent"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.errors.server.successCount",<br>      "displayName": "Number of calls without  server side errors",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.ioTime",<br>      "displayName": "IO time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.lockTime",<br>      "displayName": "Lock time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.nonDbChildCallCount",<br>      "displayName": "Number of calls to other services",<br>      "description": "",<br>      "unit": "Count"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.nonDbChildCallTime",<br>      "displayName": "Time spent in calls to other services",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.response.client",<br>      "displayName": "Client side response time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.response.server",<br>      "displayName": "Server side response time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.response.time",<br>      "displayName": "Method response time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.totalProcessingTime",<br>      "displayName": "Total processing time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    },<br>    {<br>      "metricId": "builtin:service.keyRequest.waitTime",<br>      "displayName": "Wait time",<br>      "description": "",<br>      "unit": "MicroSecond"<br>    }<br>  ]<br>}

Thank you Sebastian. I see now that the reason that I couldn’t find the KeyRequest metrics via my initial API call is that more than one page of metric data is returned… and I would have to make subsequent page calls with the next page key.

I am only unclear on two things at this point:

1. What is the difference between builtin:service.keyRequest.response.client and builtin:service.keyRequest.response.server? In the Key Request chart there is only a “Response Time” shown and I would have expected all key request time would be considered to be server time… so I am unclear what “client” time would be.

2. To obtain the response time for a specicic Key Request I would need to reference an entitySelector and an entityID, as shown below… I am unclear how I can obtain the correct entityID for my KeyRequest… in the DT GUI I only see KeyRequest names and it isn’t clear to me how to lookup this ID.

https://<ENV>/api/v2/metrics/query?Api-Token=<Token>&metricSelector=builtin:service.keyRequest.response.server&entitySelector=type(SERVICE_METHOD),entityId(SERVICE_METHOD-052B9DE0A341E2BC)&resolution=M&from=now-12M

I realize that I could do a lookup using name, but names are not always unique and we often have many key requests with the same name… the following, for example returns several Key Requests IDs…

https://<ENV>/api/v2/metrics/query?Api-Token=<TOKEN>&metricSelector=builtin:service.keyRequest.response.server&entitySelector=type(SERVICE_METHOD), entityName (/RFEApp/Index.html)&resolution=M&from=now-12M

@Jeff R.

Did you figure out this part how to filter the data to some specific Key Request? I currently struggling with the same thing that have not understood yet how to use the certain Key Request as a filter on Metrics api V2.

2. To obtain the response time for a specicic Key Request I would need to reference an entitySelector and an entityID, as shown below… I am unclear how I can obtain the correct entityID for my KeyRequest… in the DT GUI I only see KeyRequest names and it isn’t clear to me how to lookup this ID.

https://<ENV>/api/v2/metrics/query?Api-Token=<Token>&metricSelector=builtin:service.keyRequest.response.server&entitySelector=type(SERVICE_METHOD),entityId(SERVICE_METHOD-052B9DE0A341E2BC)&resolution=M&from=now-12M