Skip to main content


The datadog plugin supports the integration with Datadog, one of the most used observability service for cloud applications. When enabled, the plugin pushes metrics to DogStatsD server, which comes bundled with the Datadog agent, over UDP protocol.


The plugin exports the following metrics by default.

All metrics will be prefixed by the namespace configured in metadata. For example, if the namespace is configured to be apisix, you will see the request.counter metric exported as apisix.request.counter in Datadog.

request.countercounterNumber of requests received.
request.latencyhistogramTime taken to process the request, in milliseconds.
upstream.latencyhistogramTime taken to proxy the request to the upstream server until a response is received, in milliseconds.
apisix.latencyhistogramTime taken by APISIX agent to process the request, in milliseconds.
ingress.sizetimerRequest body size in bytes.
egress.sizetimerResponse body size in bytes.


The plugin exports metrics with the following tags.

When there are no suitable values for any particular tag, the tag will be omitted.

route_nameName of the route. If not present or if the attribute prefer_name is set to false, fall back to the route ID.
service_nameName of the service. If not present or if the attribute prefer_name is set to false, fall back to the service ID.
consumerUsername of the consumer if the route is connected to a consumer.
balancer_ipIP address of the upstream balancer that processes the current request.
response_statusHTTP response status code.
schemeRequest scheme, such as HTTP and gRPC.


The examples below demonstrate how you can configure datadog plugin for different scenarios.

Update Datadog Agent Address and Other Metadata

By default, the plugin expects the DogStatsD server to be available at To customize the address and other metadata, update the plugin metadata as such:

curl "" -X PUT \
-d '{
"host": "",
"port": 8181,
"namespace": "apisix",
"constant_tags": [

To reset to default configuration, send a request to the datadog plugin metadata with an empty body:

curl "" -X PUT -d '{}'

Monitor Route Metrics

The example below shows how you can send the metrics of a particular route to Datadog.

Create a route with the datadog plugin and a few optional configuration options:

curl "" -X PUT \
-d '{
"id": "datadog-route",
"uri": "/anything",
"plugins": {
"datadog": {
"batch_max_size" : 1,
"max_retry_count": 0
"upstream": {
"type": "roundrobin",
"nodes": {
"": 1

batch_max_size: set to 1 to send the metric immediately.

max_retry_count: set to 0 to disallow retries if metrics were unsuccessfully sent.

Generate a few requests to the previously created route:

curl ""

In Datadog, Select Metrics from the left menu and go to Explorer. Select apisix.ingress.size.count as the metric. You should see the count reflecting the number of requests generated:

apisix-datadog-ingress-size-count 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