datadog
This plugin pushes its custom metrics to the DogStatsD server, comes bundled with Datadog agent (to learn more about how to install a datadog agent, please visit ), over the UDP protocol. DogStatsD basically is an implementation of StatsD protocol which collects the custom metrics for Apache APISIX agent, aggregates it into a single data point and sends it to the configured Datadog server. To learn more about DogStatsD, please visit DogStatsD documentation.
This plugin provides the ability to push metrics as a batch to the external Datadog agent, reusing the same datagram socket. In case if you did not receive the log data, don’t worry give it some time. It will automatically send the logs after the timer function expires in our Batch Processor.
For more info on Batch-Processor in Apache APISIX please refer.
Attributes
The plugin supports the use of batch processors to aggregate and process entries(logs/data) in a batch. This avoids frequent data submissions by the plugin, which by default the batch processor submits data every 5
seconds or when the data in the queue reaches . For information or custom batch processor parameter settings, see configuration section.
Exported Metrics
Apache APISIX agent, for every request response cycle, export the following metrics to DogStatsD server if the datadog plugin is enabled:
The metrics will be sent to the DogStatsD agent with the following tags:
- service_name: If a route has been created with the abstraction of service, the particular service name/id (based on plugin attribute) will be used.
- consumer: If the route has a linked consumer, the consumer Username will be added as a tag.
- balancer_ip: IP of the Upstream balancer that has processed the current request.
- scheme: Scheme that has been used to make the request, such as HTTP, gRPC, gRPCs etc.
The following is an example on how to enable the datadog plugin for a specific route. We are assuming your datadog agent is already up an running.
Disable Plugin
Remove the corresponding json configuration in the plugin configuration to disable the datadog
. APISIX plugins are hot-reloaded, therefore no need to restart APISIX.
In the default configuration, the plugin expects the dogstatsd service to be available at . If you wish to update the config, please update the plugin metadata. To know more about the fields of the datadog metadata, see .
Make a request to /apisix/admin/plugin_metadata endpoint with the updated metadata as following:
This HTTP PUT request will update the metadata and subsequent metrics will be pushed to the 172.168.45.29:8126
endpoint via UDP StatsD. Everything will be hot-loaded, there is no need to restart Apache APISIX instances.