API Telemetry and APM

Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices


Trace API requests and responses and collects statistics. With Swagger specification provided, monitor API Operations defined in the spec


Monitor API Operations detected on the fly based on Node.js Express routes


Get statistics on requests and responses, errors, processing time, content length, rates - per method, per API Operation, over time


swagger-stats exposes metrics in Prometheus format, so you may use Prometheus and Grafana for API monitoring and alerting


swagger-stats stores API request/response details in Elasticsearch so you may perform detailed analysis of API usage over time


Build Dashboards in Grafana based on swagger-stats Prometheus metrics


Comes with Built-In Telemetry User Interface. Open /swagger-stats/ui to start monitoring right away, without any infrastructure requirements


Analyze API traffic in Kibana, build Visualizations and Dashboards

API Analytics with Elasticsearch and Kibana


API Monitoring and Alerting with Prometheus and Grafana


Built-In API Telemetry



At a glance Summary view gives you key metrics on requests, errors, rates, and handling time. Timeline shows volumes of requests and responses by class per minute over last 60 minutes so you can quickly spot trends

Rates & Durations

Requests and Errors rates, Maximum, Average and Total Handle Time. Current values are calculated for the last minute, and Overall values - for entire run time. Trend of requests and errors rates per minute over last 60 minutes


Stats by Request Method. See request and error volumes, rates, errors by class, handle time and payload sizes per GET, POST, PUT, DELETE ...


Stats and Trends of API requests payload (content length) received in requests and sent in responses

API Calls

API Operation statistics. For each Path and Method shows metrics on requests and errors volumes, rates, handle time, payload. Shows API Operation from Swagger spec, including description and tags, so you can quickly find specific operation. API Operations based on express routes will be added to the list on the fly as they are invoked.

API Operation

Details about individual API operations. Key metrics summary, list of parameters from Swagger spec and stas of parameters usage: number of time parameter was passed, number of time mandatory parameter was missing


Counts of Errors responses by status code. "404 Not Found" path counts: see what path was requested and not found most of the times. "500 Internal Server Error" path counts: see what path produced most Internal Server errors

Last Errors

Last 100 Errors. Request and Response details on last 100 time error response was sent - method, URLs, parameters, request and response headers, addresses, start/stop times and processing duration, matched API Operation info

Longest Requests

Longest 100 Requests. Request and Response details on top 100 requests that took longest time to process - method, URLs, parameters, request and response headers, addresses, start/stop times and processing duration, matched API Operation info

Auto Refresh

Observe your API stats in real time - auto-refresh reloads stats and updates current view. Adjust frequency to 1sec, 10sec, 30 sec or 1 min, pause / resume

Install & Enable

npm install swagger-stats --save
var swStats = require('swagger-stats');
var apiSpec = require('swagger.json');
npm version

Get stats with API

$ curl http://<your app host:port>/swagger-stats/stats
"startts": 1501647865959,
"all": {
"requests": 7,
"responses": 7,
"errors": 3,
"info": 0,
"success": 3,
"redirect": 1,
"client_error": 2,
"server_error": 1,
"total_time": 510,
"max_time": 502,
"avg_time": 72.85714285714286,
"total_req_clength": 0,
"max_req_clength": 0,
"avg_req_clength": 0,
"total_res_clength": 692,
"max_res_clength": 510,
"avg_res_clength": 98,
"req_rate": 1.0734549915657108,
"err_rate": 0.4600521392424475
"sys": {
"rss": 59768832,
"heapTotal": 36700160,
"heapUsed": 20081776,
"external": 5291923,
"cpu": 0
"name": "swagger-stats-testapp",
"version": "0.90.1",
"hostname": "hostname",
"ip": ""

Open Source


swagger-stats is free and open source, under MIT license


If you find a bug, or have an enhancement in mind please post issues on GitHub.


© 2017 slana.tech