You signed up to the API analytics tool (Galileo) and you’re wow-ing at the possibilities, but exactly how much can this tool help you in your day to day job?
- I am going to analyse what business questions can be answered from an API perspective as a manager, developer, user or as a mixture of each.
- Then I will dig into the metrics that will be available to us and formulate relevant questions.
- Finally I will create a dashboard report using the required data.
Analytics are not simply “pretty graphs” to show your coworkers or friends. You shouldn’t just track a couple of metrics like signups or latency and display them on dashboard in a corner of your office. Thinking how analytics and metrics help your business is critical.
You should plan an analytics strategy in a way that it will allow you to learn from your customers; specifically, how is your API being used..
Following this reasoning you should place your analytics at the center of a learning framework, thus planning is your first step into becoming an API analytics ninja.
The best way to plan is to create a set of business questions .
Don’t do this exercise alone; instead gather a few members of your team and start writing down what it is that you’re trying to answer: Think about problems you’re trying to solve and how your API platform analytics can help the business.
Valid questions upon which you can take action are:
- How many users access your product through the API?
- What are your users building with the API?
- Which users are about to leave your platform?
- What technologies are being used to access your API?
- Which API endpoints are under load?
- What are the most common errors users face when consuming your API?
- What is the health status is the API?
- What devices are consuming your API?
- What happens if you raise the price of your API?
- Who are your most active users?
Now that you have planned what to track, let’s see how you find the answers.
Nowadays pretty much every system has (or should have) an API.
In the same way you ask front-end developers and marketing teams to set-up trackable actions through your platform’s interface, you should ask back-end developers to add tracking for your API.
The questions listed above are only some of the ones that could be answered with an API analytics tool. You might have many more or very different questions, it’s your job to formulate relevant questions. You can break them down into more granular and focussed questions .
You are aiming to spot trends that affect your platform and business. Ultimately you will be able to understand how your platform responds to certain behaviours such as endpoint stress, latency chaos, error flooding etc.
The answer to this question is like most questions in life: Depends on what you are trying to do.
I am going to focus on understanding and answering the questions listed below; in doing so, I can show my line of thought when building reports. Each question has a combination of metrics. I will also explain my reasoning for having them grouped up together.
- Errors: I want to be able to see how many errors are being generated by every API call; plus, I want the ability to drill down and filter requests by error code.
- Latency: I want to be able to understand how long the API takes to respond. This is calculated by taking a delta between the time a request arrives and the time it takes to provide a reply.
- Request Methods: I want to be able to filter what request methods are being used and result in API responses with error statuses.
- Traffic: I want to be able to understand how much traffic is passing through the ether between clients and servers.
- In my Health Status API dashboard I set the timeframe to hourly.
- Number of requests (filtered by authentication header): If you have set up authentication on your endpoints, it will be simple to find out which are the most active users by parsing.
- Number of requests (filtered by IP): If you did not set up authentication on your endpoint (you should go and do it!!!) ,consider grouping requests by IP address to understand which clients are connecting most to your API. This makes the question harder to answer as you will be lacking information about who sits on the other side of the IP.
- Number of successful requests: I want to make sure the requests counter is performing 200 success codes; therefore, I know it’s not a bot or a service left running in a loop causing the high numbers.
- In my Most Active API Users dashboard I set the time frame to monthly. This way I have a good idea of who are the most active users each month.
- Endpoint name: By having a report that lets me see which endpoint is being targeted, I can analyse the traffic hitting the servers.
- Transactions: This is the most important piece of the puzzle. I want to be able to see how many requests are hitting a particular endpoint at any one time.
- User: View how many transactions each account has made and identify if there is a particular user that triggered my alert.
- In my Traffic-load Status API dashboard I set the time frame to daily. This way I have a good idea of the stress load on my API every day.
A report and dashboard should give you an idea of what is happening in a glance: what is working as intended and what isn’t over a specific period of time.
To achieve the above snapshot you need to pick the right metrics and time-frame to analyse, whether it’s minutes, days or weeks depends on the question you’re asking yourself.
We already covered the metrics part above.
Do not be afraid of having different views of the same data with different time-frames; as sometimes they answer questions such as ‘How many errors are being generated by our API every hour’ or ‘How many errors have we experienced this month.’However think of what could be represented by picking a wrong time-frame. Do you really want to see the number of API clients registering to your service per second?
Would you rather see how registrations change over the period of a week or a month?
In this section, we assume you have already set up the Analytics agent; if not, take a look at these guides .
After logging into Galileo create a new report by clicking on the ‘New Report’ button as shown below.
Here’s how you can generate a report.
The first (1) action is to name your report; as an example, let’s start with creating a ‘Health Status: Errors’ report.
Section (2) for the report allows you to create filters that limit the amount of data on your report given a condition.
In this scenario you will add a filter that shows only API responses producing an error:
Filter Dimension: Response Status
This will limit all data in the report to be only the error data
Here you can group data by a given property.
For this scenario you want to group data by Request Method and Request Path.
This allows you to understand what methods or endpoints (paths) are generating the most errors .
Selecting data fields here will let you create Filters later on.
The tabular data provides further aggregation of data. For this example report you don’t need any, therefore simply omit selecting another reference point.
– Step C – Framing in
The above is a screenshot of the resulting dashboard and report.
Its elements will be outlined below.
Try experimenting with these settings to give you the right amount of details in your API report.
Set the time-frame too high or too low and you could miss out on events that impact your business.
Additionally Galileo supports real time analytics, meaning you can see what is happening seconds after the action. This way you can analyze the status and events of your API as they happen.
A good example of this is selecting the right time-frame to calculate the amount of errors being produced by your API. You might want to lower the ‘Last 24 Hours’ filter to a smaller time-frame so that you can focus on seeing when things go wrong.
In a similar fashion you might want to set the intervals to ‘minutes’ rather than ‘hours’.
As Specified earlier, you can order and toggle the visibility on different methods.
Additionally because Path was specified as a Data Grouping the table will also show you which routes are being associated with each request.
Finally, you can see how many times a certain endpoint has been reached and inspect the requests further by hitting the log button.
Each column of the table can be clicked to order the data in ascending or descending order.
4. Drilling down
You can drill down on each endpoint to isolate the analytical data for that particular endpoint. This will create a ‘filter’ on your report that you can see under the graph.
Filter allow you to drill down into specific categories of data.
For example you want to filter all the methods GET or a specific path. You might want to filter all request that match a certain URI, of a certain latency. Depending on what you have specified earlier when you specified the
Filters are dynamic, you retain control of which filter to keep active through the graphical user interface.
Each filter can be removed .
If you have more columns, you can further drill down the data by selecting these values as filters.
Galileo is a great analytical tool for both beginners and advanced users:
By building a dashboard step by step, I have shown you how simple and quick it is to create a report.
As your API reporting necessity evolves you might want to add more reports to the sidebar.
All your data belongs to you. For advanced users that want to experiment, you can download the data for further processing.. But try at your own risk!