For new deployments, we recommend OpenTelemetry Metrics instead: Tyk Gateway pushes Rate, Errors, and Duration (RED) metrics via an OpenTelemetry Collector. This page remains relevant for existing deployments already using Tyk Pump for metrics.
Introduction
Tyk Pump can independently expose metrics, derived from the traffic logs it reads out of Redis, the same traffic logs used for Dashboard Analytics. These metrics are computed by Tyk Pump after the fact from traffic log records, so it can only produce traffic-derived counters and histograms (status codes, latency, and whatever traffic log fields you tag). It has no visibility into Gateway’s own runtime health or configuration state, unlike OpenTelemetry metrics. Three pump types expose metrics this way, all deriving from the same traffic log fields:Not to be confused with Tyk Gateway’s native StatsD instrumentation: that’s a completely different, built-in mechanism exporting internal system metrics (request rate, goroutine health, and so on), not traffic-log-derived request metrics. The StatsD pump on this page is unrelated to that feature.
Prometheus
Tyk Pump can expose Prometheus metrics derived from the traffic logs it reads out of Redis, useful for tracking how often your APIs are called, how they perform, and what status codes they return. See the demo project on GitHub for a working example. Unlike the other pumps on this page, Tyk Pump doesn’t send these metrics anywhere itself: it exposes them on a plain HTTP endpoint (/metrics by default), and Prometheus scrapes that endpoint on its own schedule.
Base Metrics
By default, theprometheus pump exposes these metrics:
You can add further custom metrics of your own; see Custom Metrics below.
Configuring the Pump
In addition to the common pump settings, theprometheus pump accepts the following meta fields. Add them to pump.conf:
Tyk Pump will listen on the port configured in
listen_address. The Prometheus scraper must be configured to access that port on the Tyk Pump service. You must ensure that the port is exposed for the scraper to find.
Restart Tyk Pump, then verify metrics are exposed by visiting http://<tyk-pump-host>:9090/metrics from a machine that can reach it. Then add a scrape target to your Prometheus configuration pointing at that same host and port, and connect a Grafana data source to your Prometheus server. See the Tyk Pump GitHub repository for example dashboard queries, including request rate, error rate, and percentile latency, per API or across all APIs.
Custom Metrics
The base metrics above cover a fixed set of dimensions. You can define your own counters and histograms instead, built from any traffic log fields you choose as labels, for example, you could break down requests by a custom aggregation tag or API alias that the base metrics don’t expose. Add custom metrics to your Prometheus pump using thecustom_metrics object in the pump meta:
Docker
Iflisten_address is set to :9090, make sure to publish port 9090 in addition to the health check port.
For example, in Docker Compose:
Kubernetes
Tyk Pump’s Prometheus endpoint can be scraped on Kubernetes using either of the standard Prometheus discovery mechanisms:- Prometheus Operator: if enabled on your cluster (for example via the kube-prometheus-stack chart), it looks for
PodMonitororServiceMonitorresources and scrapes the specified port automatically. Enable this withtyk-pump.pump.prometheusPump.prometheusOperator.enabled=trueon the Tyk OSS Helm chart. - Pod annotations: if your Prometheus deployment scrapes pods by annotation instead, for example using the prometheus-community/prometheus chart, set matching
prometheus.io/scrape,prometheus.io/path, andprometheus.io/portannotations viatyk-pump.pump.podAnnotations.
/metrics: set tyk-pump.pump.service.enabled: true.

StatsD
StatsD is a network daemon that listens for statistics sent over UDP or TCP and forwards aggregates to pluggable backend services. Thestatsd pump sends per-request metrics to a StatsD server this way, derived from the same traffic logs as the other pumps on this page.
In addition to the common pump settings, the statsd pump accepts the following meta fields:
DogStatsD (Datadog)
Tyk Pump can send API traffic analytics to Datadog, which you can use to build dashboards from your API traffic. Prerequisites:- A working Datadog agent. See the Datadog Tyk integration documentation.
- A Tyk Self-Managed or Tyk Open Source installation with Tyk Pump configured.
dogstatsd pump sends the request_time metric from Tyk Pump in real time, per request, so you can aggregate by API, version, response code, method, and other parameters.
In addition to the common pump settings, the dogstatsd pump accepts the following meta fields:
Including
path as a tag can generate significant cardinality, since it’s unbounded.env:tyk-demo-env and that dogstatsd.meta.namespace is set to pump. You can also import it from the Datadog integrations-extras repository and adjust those values to match your own setup.
