In this article, learn which API metrics you should watch and how Uptrends’ API Monitoring can help you with API tracking and reporting.
It is important to know the availability, speed, and validity of API responses whether you publish an API for consumption or your website or app relies on one or more APIs. If an API slips in any of those areas, you’ve got potential trouble. Uptrends API Monitoring has multiple ways to enable you to safeguard your APIs.
API availability monitoring
If your API isn’t reachable, nothing else matters, right? Good news! Availability is an easy metric to track. API uptime is one of the simplest and inexpensive metrics you can monitor. Using Uptrends Webservice HTTP/HTTPS Monitors, you simply put in a URL, formulate a request (with or without basic authentication), and wait for a positive or expected response.
Once set up, Uptrends worldwide network of over 220+ checkpoint locations go to work. As frequently as once a minute, one of the designated checkpoints sends a request to the monitored API. A failed check results in an immediate retest to confirm an error. In the event of a confirmed error, Uptrends advanced alerting sends out a notification. Once Uptrends gets a successful result, Uptrends calculates the outage based from the time of the first confirmed error until the time of the first error-free test.
Tracking SLAs
If you have a service level agreement (SLA) with your API provider or users, you need to know what the uptime percentage is for the API. Uptrends’ SLA tracking keeps a running count of your uptime, making it easy to see what your availability looked like for a given period.
SLA tracking lets you know if your API uptime is within your agreement, coming dangerously close to breaking your agreement, or if you’ve exceeded your allotted amount of unscheduled downtime (see figure below).
API response time
Response time is a critical metric for some API interactions. Slow API responses can increase wait times, make applications appear choppy, and cause other functions to fail that rely on a fast response. You’ve got a couple of different ways to track response times.
Tracking response time using web service monitors
Your Webservice HTTPS/HTTP uptime monitor also tracks your server’s response time, and you can use the value as a basic response time metric and to trigger alerts.
Your Check Details report gives you several different performance-related metrics:
- Load time: The total time it took to complete the test.
- Resolve time: Time it took to resolve the URL to an IP address.
- Connection time: Time it took to establish a connection to the server.
- Download time: Time it took to complete the download once started.
The sum of the resolve, connection, and download times result in the Load time metric (see Check Detail report below).
On your monitor’s dashboard, you can view tables and graphs to get a record of your response speed over time. Your dashboard gives you the average timings by the hour, day, or month in the table and chart format (see figure below).
Tracking API response times using Multi-Step API Monitoring
A Webservice HTTP/HTTPS is an effective way to track a single API response for availability, response time, and response codes; however, the monitor can’t validate and reuse data from the response.
Multi-Step API Monitoring can track the response times, validate responses, and reuse data in future API calls. Multi-Step API Monitoring tracks the response times for each API call in the transaction, and by using assertions, you can verify that response times remain within a specified maximum. If the request surpasses the maximum step duration, the test fails.
In the screenshot below, the maximum duration is set to two seconds.
In your Check Detail reports, you get the timings for the individual steps. The excerpt from the Check Detail report below shows the step duration in the upper left corner.
Opening the monitor’s dashboard, you can get per-step-timing averages in table and graph form. The chart and table show all step timings, even those that don’t contain an API call. For example, notice the Wait for seven seconds data below. A wait step allows for additional processing time before moving on to the next step. It is important to remember that wait steps add to the Total time metric for the test.
Checking for latency
Latency, the amount of time it takes for a request or response to travel between the client and the host, is affected by the distance traveled and any network congestion between the two. Latency from network congestion tends to be sporadic and may follow patterns based on the time of the day. However, latency due to distance is fairly constant.
To check for latency issues that your users may experience, we recommend using a Ping Monitor type. A ping test can give you the best information on latency because it bypasses the server’s processing of a regular API request. Although it does take time for the server to acknowledge the ping test, the time and resources needed for a server to formulate a response to a ping test are minimal.
In the example below, you can see that Hanoi and Bangkok both have response times at a half-second or more consistently. Consistently high total times metrics are often indicative of a possible latency issue.
To measure the response times in the chart above, we set up a Ping monitor type using Concurrent Monitoring. With Concurrent Monitoring enabled, each designated checkpoint conducts a ping test once a minute. Concurrent monitoring gives you a nearly constant flow of data from your chosen checkpoints allowing you to spot latency problems quickly. However, standard monitoring can also show latency problems, but it takes a longer monitoring period.
Tracking custom metrics
You may have data in your responses that you want to track. For example, your API responds with the number of concurrent users, and you would like to track the number of users alongside your API performance data. You can capture the number of users and include them in your reporting to see how the metric changes over time and generate reports that compare the number of users to your performance metrics. Read more about custom API metrics.
Wrapping up
You can track all the above metrics for the APIs you publish or third-party APIs your app or business depends on. Uptrends’ monitoring gives you the tools you need to verify availability, performance, latency, and responses. Try API monitoring for free. Our 30-day trial expires automatically, and you don’t need a credit card.