Express
Setup
We recommend the Express Middleware exporter. To set up this exporter, just add it s a dependency in your NodeJS package.json
Import the package and add it to the Express app.
If the request URLs include ids. for e.g. GET /order/1234567, the URLs need to be captured as /order/{id} to avoid metric explosion. In this example, the regexp [0-9]+ which captures all numbers 1234567 can be specified in the extraMasks list of regular expressions.
You can verify the presence of the following metrics
http_requests_total
http_request_duration_seconds_count
http_request_duration_seconds_sum
http_request_duration_seconds_bucket
Metrics
Metric | KPI |
Requests http_requests_total | Request Rate rate(http_requests_total[5m]) |
Errors http_requests_total | Error Ratio (server errors) rate(http_requests_total{status=~"5.."}[5m])/ rate(http_requests_total[5m]) Error Ratio (client errors) rate(http_requests_total{statusCode=~"4.."}[5m])/ rate(http_requests_total[5m]) |
Latency http_request_duration_seconds | Latency Average rate(http_request_duration_seconds_sum[5m])/ rate(http_request_duration_seconds_count[5m]) Latency P99 histogram_quantile ( 0.99, sum(rate(http_request_duration_seconds_bucket[1m]) > 0) by (le) ) |
Alerts
KPI | Alerts |
Request Rate | RequestRateAnomaly |
Error Rate | ErrorRatioBreach ErrorBuildup based on a 99.9 SLO |
Latency Average Latency P99 | LatencyAverageBreach LatencyAverageAnomaly LatencyP99ErrorBuildup |
Dashboards
Service KPI Dashboard
This dashboard has the following KPIs from resources and requests:
Request Rate
Latency Average
Latency P99
Error Rate
CPU %
CPU Cores Used
CPU Throttle
Memory %
Memory Bytes
Disk Usage
Network Usage
Last updated