You are browsing documentation for an outdated plugin version.
Looking for the plugin's configuration parameters? You can find them in the Datadog configuration reference doc.
Log metrics for a service or route to a local Datadog agent.
Metrics
The Datadog plugin currently logs the following metrics to the Datadog server about a service or route.
Metric | Description | Namespace |
---|---|---|
request_count |
tracks the request | kong.request.count |
request_size |
tracks the request’s body size in bytes | kong.request.size |
response_size |
tracks the response’s body size in bytes | kong.response.size |
latency |
tracks the time interval between the request started and response received from the upstream server | kong.latency |
upstream_latency |
tracks the time it took for the final service to process the request | kong.upstream_latency |
kong_latency |
tracks the internal Kong latency that it took to run all the plugins | kong.kong_latency |
The metrics will be sent with the tags name
and status
carrying the API name and HTTP status code respectively. If you specify consumer_identifier
with the metric, a tag consumer
will be added.
Metric fields
Plugin can be configured with any combination of Metrics, with each entry containing the following fields.
Field | Description | Data types | Allowed values |
---|---|---|---|
name |
Datadog metric’s name | String | Metrics |
stat_type |
Determines what sort of event the metric represents | String |
gauge , timer , counter , histogram , meter , set , distribution
|
sample_rate conditional |
Sampling rate | Number | number |
consumer_identifier conditional |
Authenticated user detail | String |
consumer_id , custom_id , username
|
tags optional |
List of tags | Array of strings | key[:value] |
Metric requirements
- All metrics get logged by default.
- Metrics with
stat_type
ascounter
orgauge
must havesample_rate
defined as well.
Migrating Datadog queries
The plugin updates replace the api, status, and consumer-specific metrics with a generic metric name. You must change your Datadog queries in dashboards and alerts to reflect the metrics updates.
For example, the following query:
avg:kong.sample_service.latency.avg{*}
would need to change to:
avg:kong.latency.avg{name:sample-service}
Setting host and port per Kong node basis
When installing a multi-data center setup, you might want to set Datadog’s agent host and port on a per Kong node basis. This configuration is possible by setting the host and port properties using environment variables.
Note:
host
andport
fields in the plugin config take precedence over environment variables.
Field | Description | Data types |
---|---|---|
KONG_DATADOG_AGENT_HOST |
The IP address or hostname to send data to. | string |
KONG_DATADOG_AGENT_PORT |
The port to send data to on the upstream server. | integer |
Kong process errors
This logging plugin logs HTTP request and response data, and also supports stream data (TCP, TLS, and UDP).
The Kong process error file is the Nginx error file. You can find it at the following path:
{prefix}/logs/error.log
Configure the prefix in
kong.conf
.