Runscope API Monitoring    Learn More →

Monitoring API Performance with the New API Metrics Endpoint

By Heitor Tashiro Sergent on .

We have a new endpoint available for the Runscope API! Now you can retrieve your API tests performance metrics for each individual test, keep a pulse on your API's performance over time, and create custom internal or external dashboards with it.

The endpoint returns the same information that you can find in the Overview tab of your API test, under Test Performance:

1-dashboard-test-performance.png

Using the API Metrics endpoint

You can use the new endpoint by making a request to:

https://api.runscope.com/<bucket_key>/tests/<test_id>/metrics

And you can filter the request by using 3 different parameters:

  • region - The service region you're using to run your tests (e.g. us1, us2, eu1, etc.)
  • timeframe - Hour, day, week, or month. Depending on the timeframe you use, the interval between the response times will be different.
  • environment_uuid - Filter by a specific environment, such as test, production, etc.

The endpoint will return the same information you can find in the dashboard. An example response will look like this:

{
    "response_times":[
        {
            "success_ratio":0.3333333333333333,
            "timestamp":1494964800,
            "avg_response_time_ms":44
        },
        {
            "success_ratio":0.5517241379310345,
            "timestamp":1494968400,
            "avg_response_time_ms":39
        },
         
        
         
        {
            "success_ratio":1.0,
            "timestamp":1495044000,
            "avg_response_time_ms":46
        },
        {
            "success_ratio":0.9965397923875432,
            "timestamp":1495047600,
            "avg_response_time_ms":45
        }
    ],
    "change_from_last_period":{
        "response_time_50th_percentile":0.05284147557328004,
        "response_time_99th_percentile":-0.03965577026132455,
        "total_test_runs":-0.0313588850174216,
        "response_time_95th_percentile":0.2567257314416911
    },
    "environment_uuid":"all",
    "region":"us1",
    "timeframe":"day",
    "this_time_period":{
        "response_time_50th_percentile":44.0,
        "response_time_99th_percentile":101.54999999999998,
        "total_test_runs":296,
        "response_time_95th_percentile":88.94999999999997
    }
}

Keep in mind that each element inside response_times can represent multiple test runs, depending on the time interval you use when calling the metrics API.

You can store that information in an external service if you want to keep track of performance for a period longer than 30 days, or if you want to build your own custom internal or external dashboard.

For more information about the endpoint, you can check out our API reference docs here. If you have any questions, please reach out to our awesome support team.



Categories: announcements, apis, monitoring, testing

Everything is going to be 200 OK®