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

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

jeff_rowell
Organizer

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


3 REPLIES 3

Use this as metric selector:

builtin:service.keyRequest.*

These are results:

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

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