Performance record data in our API

We'll assume you've already got the API authentication settled and you have our API key with you (this is the Authorization header in all the examples used below).

Retrieving performance records #

You can retrieve all performance records by calling the /performance-records endpoint. This can be done per website in your Oh Dear account, so you'll need to know your site's ID first.

A filter is necessary: you decide from when to when the data should be returned.

In this example we'll get a list of all sites and use the site ID to retrieve the performance data.

$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/sites \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

{
  "data": [
    {
      "id": 1,
      "url": "https://www.yoursite.tld",
      "...",
    }
  ]
}

Here, we'll query the performance data between yesterday and today, on the 1m timeframe. That's our most granular & most detailed timeframe available.

$ curl https://ohdear.app/api/sites/1/performance-records?filter[start]=20200703130619&filter[end]=20200704130619&filter[timeframe]=1m \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

{
  "data": [
    {
      "id": 121,
      "site_id": 1,
      "created_at": "2020-06-04 11:18:15",
      "time_namelookup": 0.032941,
      "time_connect": 0.029106,
      "time_appconnect": 0.076993,
      "time_pretransfer": 0.00015999999999999348,
      "time_remoteserver": 0.03007500000000002,
      "time_redirect": 0,
      "time_download": 0.0007059999999999844,
      "time_total": 0.169981
    },
    {
      "id": 122,
      "site_id": 1,
      "created_at": "2020-06-04 11:19:15",
      "time_namelookup": 0.008363,
      "time_connect": 0.020259,
      "time_appconnect": 0.042906999999999994,
      "time_pretransfer": 0.00010600000000000886,
      "time_remoteserver": 0.020762000000000003,
      "time_redirect": 0,
      "time_download": 0.0005309999999999898,
      "time_total": 0.092928
    },
    {
      ...
    }
  ],
}

If there are no performance records in the requested period, you'll receive an empty data array.

{
  "data": [],
}

Selecting the timeframe for data #

In the example above, we queried for the 1m timeframe. That returns data records for every minute we probed the website. These records are stored for roughly 14 days.

They are then consolidated to 1h records, and kept eternally.

You may modify the timeframe parameter in the query to use 1h instead of 1m to select the hourly, aggregated, data.

Performance record data explained #

The API returns the detailed performance metrics for each datapoint we have.

{
  "time_namelookup": 0.008363,
  "time_connect": 0.020259,
  "time_appconnect": 0.042906999999999994,
  "time_remoteserver": 0.020762000000000003,
  "time_redirect": 0,
  "time_download": 0.0005309999999999898,
  "time_total": 0.092928
},

Each floating point value is the amount of seconds it took to process that particular piece of the request.

In most cases, it will be expressed in miliseconds, not seconds. So 0.0429 can be read as 42.9ms.

By multiplying each value by 1,000, you get the value in miliseconds.

The data represents the following part of the request:

  • time_namelookup: The time it takes to resolve the domain name to an IP address via DNS.
  • time_connect: The time it takes to connect to the remote host (TCP three-way handshake).
  • time_appconnect: The total time it took for the TLS handshake to complete (cipher negotiation & encryption).
  • time_remoteserver: The time it took the server to process the request and start sending the first byte of the page.
  • time_download: The time, in seconds, it took for the page to be downloaded.
  • time_total: The total time it took from start to finish of this request.

Was this page helpful to you? Feel free to reach out via support@ohdear.app or on Twitter via @OhDearApp if you have any other questions. We'd love to help!