• English日本語한국어
  • Log inStart now

Get web transaction time data (v2)

The metric timeslice data presented on the Web transaction time chart on your application's Summary page will depend on your web app's configuration. Possible components may include:

  • Response time
  • Application total time for your agent language
  • Datastore, Database or (Ruby) Database
  • Web external
  • Memcache
  • Request queuing time

This describes how to use the REST API (v2) to obtain the data shown on the Web transaction time chart.

General API values

When making your own calculations, be aware of the following:

  • You can change the default time range (30 minutes) used in these examples.
  • The time range you specify must be consistent in all of these queries; otherwise the final calculations will be incorrect.
  • The HttpDispatcher:call_count is used in almost every calculation, but you only need to acquire it once for your specified time range.
  • You must replace the ${APP_ID} and ${API_KEY} variables in these examples with your specific application ID and API key.

HttpDispatcher

The overlaid response time line on the Web transaction time chart represents the Request queuing time combined with the HttpDispatcher time. The HttpDispatcher:average_response_time is the total response time for your web application without the request queuing time and is obtained directly. It is not used to calculate the application total time.

Use the following command to obtain this metric:

bash
$
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
>
-H "X-Api-Key:${API_KEY}" -i \
>
-d 'names[]=HttpDispatcher&values[]=average_response_time'

Application total time

The Application total time refers to your New Relic agent language (Java/JVM time, PHP, Python, etc.). This includes all the processing time that is not attributed to other values on the chart except for the Request queuing time and the HttpDispatcher time. This is why you must calculate the other components first.

Use this equation to determine the Application total time:

Application total time = WebTransactionTotalTime - Datastore time - Database time - (Ruby) Database - Web external - Memcache

Each of the values in this equation are described in detail later in this document.

Application total time calculation

Comments

Terms

Not all the terms in the equation may apply. If the corresponding data does not appear for your application, the corresponding terms may be ignored.

Datastore and Database

The Datastore time, Database time, and (Ruby) Database values are not the same. As of February 2015, Datastore is being phased in to replace Database. Also, the Ruby agent stores data in a slightly different form.

Memcache

The Memcache term may not exist for all applications.

Request queuing time

The Request queuing time (if it exists) may appear in the chart in the UI, but it is not involved in the calculations. It is presented simply as a convenience.

Response time

The Response time may appear in the chart in the UI as an overlaid line. This time is not involved in the calculation for application total time.

Web transaction total time vs. HttpDispatcher

If your application does not report a WebTransactionTotalTime metric, then use the HttpDispatcher metric. The WebTransactionTotalTime metric is only present in more recent agents which may exhibit asynchronous behavior.

Web transaction total time

The WebTransactionTotalTime is the total execution time for your web application and is obtained directly. Use the following command:

bash
$
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
>
-H "X-Api-Key:${API_KEY}" -i \
>
-d 'names[]=WebTransactionTotalTime&values[]=average_response_time'

Datastore vs. database

As of February 2015, the New Relic agents display the database time separated into specific database types. For specific agent version requirements, see Databases and slow queries feature availability.

These New Relic agents will replace the Database metric name with Datastore/${DBTYPE}, where ${DBTYPE} identifies the appropriate database; for example, Postgres, MongoDB, Microsoft SQL Server, ODBC, Redis, SQLite, Memcached, Solr, Elasticsearch, etc.

Datastore total time

If your Web transaction time chart shows the generic Database category, do not use these calculations. Instead, use the Database calculations.

The Datastore total time is a derived value. To calculate it, use this equation:

Datastore time = ( Datastore/${DBTYPE}/allWeb:average_response_time * Datastore/${DBTYPE}/allWeb:call_count ) / HttpDispatcher:call_count

The ${DBTYPE} represents the type of database reported; for example, Postgres, ODBC, Redis, MongoDB, MySQL, Microsoft SQL Server, SQLite, Cassandra, Memcached, etc. Substitute the database name as appropriate.

To obtain the data for this calculation, use the following commands.

  • HttpDispatcher:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=HttpDispatcher&values[]=call_count'
  • Datastore/${DBTYPE}/allWeb:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Datastore/${DBTYPE}/allWeb&values[]=call_count'
  • Datastore/${DBTYPE}/allWeb:average_response_time

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Datastore/${DBTYPE}/allWeb&values[]=average_response_time'

You can also perform this operation in a single command:

bash
$
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
>
-H "X-Api-Key:${API_KEY}" -i \
>
-d 'names[]=Datastore/MongoDB/allWeb&names[]=HttpDispatcher&values[]=average_response_time&values[]=call_count'

Database total time

If you are using a Ruby agent older than 3.11.0, do not use these calculations. Instead, use the (Ruby) Database calculations.

The Database total time is a derived value. To calculate it, use this equation:

Database time = ( Database/allWeb:average_response_time * Database/allWeb:call_count ) / HttpDispatcher:call_count

To obtain the data for this calculation, use the following commands.

  • HttpDispatcher:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=HttpDispatcher&values[]=call_count'
  • Database/allWeb:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Database/allWeb&values[]=call_count'
  • Database/allWeb:average_response_time

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Database/allWeb&values[]=average_response_time'

(Ruby) Database total time

If you are not using a Ruby agent, use the calculations to obtain the Database value. These values are only provided by the Ruby agent versions 3.10.0.279 or lower. Ruby agent version 3.11.0 or higher uses Datastore values instead.

The (Ruby) Database total time is a derived value. To calculate it, use this equation:

(Ruby) Database = ( ActiveRecord/all:average_response_time * ActiveRecord/all:call_count ) / HttpDispatcher:call_count

To obtain the data for this calculation, use the following commands.

  • HttpDispatcher:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=HttpDispatcher&values[]=call_count'
  • ActiveRecord/all:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=ActiveRecord/all&values[]=call_count'
  • ActiveRecord/all:average_response_time

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=ActiveRecord/all&values[]=average_response_time'

Memcache total time

If available, the Memcache response time is a derived value. (Not all applications will have Memcache response time.) To calculate it, use this equation:

Memcache = ( Memcache/allWeb:average_response_time * Memcache/allWeb:call_count ) / HttpDispatcher:call_count

To obtain the data for this calculation, use the following commands.

  • HttpDispatcher:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=HttpDispatcher&values[]=call_count'
  • Memcache/allWeb:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Memcache/allWeb&values[]=call_count'
  • Memcache/allWeb:average_response_time

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=Memcache/allWeb&values[]=average_response_time'

Web external total time

The Web external total time is a derived value. To calculate it, use this equation:

Web external = ( External/allWeb:average_response_time * External/allWeb:call_count ) / HttpDispatcher:call_count

To obtain the data for this calculation, use the following commands.

  • HttpDispatcher:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=HttpDispatcher&values[]=call_count'
  • External/allWeb:call_count

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=External/allWeb&values[]=call_count'
  • External/allWeb:average_response_time

    bash
    $
    curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
    >
    -H "X-Api-Key:${API_KEY}" -i \
    >
    -d 'names[]=External/allWeb&values[]=average_response_time'
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.