Skip to main content

Version: 3.9.0

Monitor APISIX Metrics with Datadog

As the complexity of IT infrastructures and systems increases, continuous monitoring has become a vital part of any IT operation to improve system reliability and avoid costly downtimes.

Datadog is a cloud monitoring platform that offers a unified solution for metrics, logs, and tracing. The platform provides many pre-defined dashboard templates and allows for flexible customization to meet complex data analytics and visualization needs.

This guide will walk you through the process of integrating Datadog with APISIX using a containerized Datadog agent. You will be able to monitor APISIX metrics in Datadog and use them to create additional monitoring, alerting, and analytics.

APISIX and Datadog Architectural Diagram


Start Datadog Agent

The Datadog agent collects events and metrics from monitored objects and sends them to Datadog, where you can further analyze your monitoring and performance data.

Start the Datadog agent in Docker:

docker run -d \
--name dogstatsd-agent \
-e DD_API_KEY=35ebe12345678dec56218930b79fdb4cf \
-e DD_SITE="" \
-e DD_HOSTNAME=apisix.quickstart \
-p 8125:8125/udp \

DD_API_KEY: replace with your API key.

DD_SITE: replace with your Datadog site.

DD_HOSTNAME: replace with your hostname.

DD_DOGSTATSD_NON_LOCAL_TRAFFIC: set to true to listen to DogStatsD packets from other containers.

You can configure most options in the agent’s main configuration file datadog.yaml through environment variables, prefixed with DD_. For more information, see agent environment variables.

Connect Datadog Agent to APISIX

By default, the datadog plugin expects the Datadog agent to be available at To update the IP address and other metadata, configure the plugin metadata of datadog plugin as such:

curl "" -X PUT -d '
"host": "",
"port": 8125,
"namespace": "apisix"

host: replace with your IP address.

port: replace with your port, if not using the default 8125.

namespace: customize the namespace that prefixes all metrics.

Monitor Route Metrics

You can either enable the datadog plugin globally, which collect metrics from all routes; or on a specific route:

Configure datadog to be a global plugin:

curl "" -X PUT -d '
"plugins": {
"datadog": {}

Create a sample route, which you will be collecting some metrics on:

curl "" -X PUT -d '
"id": "dd-route",
"uri": "/anything",
"upstream": {
"type": "roundrobin",
"nodes": {
"": 1

In Datadog, select Metrics from the left menu and go to Explorer. You should see a number of APISIX metrics available:


Generate a few requests to the route:

curl ""

You should receive HTTP/1.1 200 OK responses.

Navigate back to Datadog metric explorer and select apisix.ingress.size.count as the metric. You should see the count reflecting the number of requests generated:


Next Steps

You have now integrated Datadog with APISIX for metrics monitoring. With these metrics, you can now create alerts and dashboards according to your system reliability requirements. For more information, see Datadog documentation. Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.


API7 Cloud

SOC2 Type IRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation