Checklist of what to measure in APIs

You have gone through the trouble of building your API, testing it and then deploying it and now you are wondering what next? Well next is to measure it of course!

Tom DeMarco wisely stated “You can’t control what you can’t measure”, this is true even in API development but to expound further, good metrics help you:

  • Identify bottlenecks in your API
  • Better manage spikes in connection
  • Setup a better plan to manage capacity
  • Troubleshoot issues as they arise

Non technical issues also benefit from good metrics, it is far better to tell your boss “Our traffic currently averages at 1000/sec with about 25% of our users still consuming v1” rather that “We are ok”

Hopefully I have convinced you of the merits of recording numbers for anything and everything you can imagine.

Below is a list of things that you can measure, this is not meant to be comprehensive but more of a checklist just to make sure you have the basics covered.

  • HTTP Status Codes: You need to know if your clients are getting the data they need
    - 100s Informational requests
    - 200s Successful requests served
    - 300s Redirects 
    - 400s Client made a bad request
    - 500s Something is wrong with your application
  • Signed requests: The number of requests to protected resources
    - Tokens issued
    - Token refreshes
    - Auth successes
    - Auth failures
    - Auth grants
    - Auth rejections
  • Client data: Number of requests related to managing data of users
    - Clients created
    - Client usage
    - Client type
    - Client location
    - Version used
  • Resource usage: so that you can know when its time to upgrade
    - DB Queries
    - Memory usage
    - CPU usage
  • Response times: we all want a snappy system
    - Response time for authorization requests
    - Response time for general requests
    - Response time for different versions

Tools

Thankfully a whole host of tools exist for helping you to measure this information

There are a lot of them in the market choose what best works for you, personally I use New relic

How do you measure your own metrics? Tell us in the comment section below

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Published by

jchencha

API Engineer