Here is an example of how to use the New Relic API Explorer (v2) to get your application's average response time over a specified time period.
Average response time
The average response time (milliseconds) is the value that appears on the main chart for your app on the APM Summary page. New Relic uses this formula to calculate response time:
Response time = HttpDispatcher:average_call_time + ((WebFrontend/Queue:call_count * WebFrontend/Queue:average_response_time) / HttpDispatcher:call_count)
To obtain the metric values, use the following two commands.
In these examples, the same time period has been used for each, and they are both summarized (averaged).
$curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \> -H "X-Api-Key:${API_KEY}" -i \> -d 'names[]=HttpDispatcher&values[]=average_call_time&values[]=call_count&from=2014-03-01T20:59:00+00:00&to=2014-03-01T21:59:00+00:00&summarize=true'
$curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \> -H "X-Api-Key:${API_KEY}" -i \> -d 'names[]=WebFrontend/QueueTime&values[]=call_count&values[]=average_response_time&from=2014-03-01T20:59:00+00:00&to=2014-03-01T21:59:00+00:00&summarize=true'
Your application may have zero queuing time for the time period in question. In that case, the WebFrontend/QueueTime
metric will have a zero value.
ヒント
If your app has never reported a queuing time, the metric WebFrontend/QueueTime
will not exist.
Response time
On the APM Summary page, Response time is the overlaid line within the main chart for your app. To obtain the metric values shown by this line, use the same formula and two commands described above, but remove summarize=true
from the commands.