Skip to main content
Version: 1.0

APM Gateway

apm-gateway is a stateless Prometheus façade for application performance monitoring. It executes PromQL queries for request rates, latency percentiles, and error rates and returns structured JSON. No database — all metrics live in Prometheus.

Prometheus Queries​

EndpointPromQL
GET /api/v1/services/metricssum by (app, namespace) (rate(http_requests_total[5m]))
GET /api/v1/endpoints/slowesttopk(10, histogram_quantile(0.99, sum by (le, handler, method) (rate(http_request_duration_seconds_bucket[5m]))))
GET /api/v1/endpoints/erroringtopk(10, sum by (handler, method) (rate(http_requests_total{status=~"5.."}[5m])))

These queries follow the OpenMetrics conventions used by Prometheus client libraries, Istio service mesh metrics, and most Kubernetes-native application frameworks.

REST API​

MethodPathDescription
GET/api/v1/services/metricsRequest rate per service (?namespace=)
GET/api/v1/endpoints/slowestTop 10 endpoints by p99 latency
GET/api/v1/endpoints/erroringTop 10 endpoints by 5xx error rate
GET/healthzHealth check

Metric Labels​

The queries expect these standard labels on http_requests_total and http_request_duration_seconds:

  • app or service — workload name
  • namespace — Kubernetes namespace
  • handler — route or endpoint path
  • method — HTTP method
  • status — HTTP status code

If your workloads use non-standard label names (e.g. Istio uses destination_service_name), update the PromQL in the handler or proxy the queries through a Prometheus recording rule.

Environment Variables​

VariableDefaultDescription
PROMETHEUS_URLhttp://localhost:9090Prometheus endpoint
PORT8101HTTP port