Log metrics for a service or route to a local Datadog agent.
ce6fc59bed (Reworked plugin queues (#5088))
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 | Datatypes | 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 |
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}
Kong process errors
This logging plugin logs HTTP request and response data, and also supports streams data (TCP, TLS, and UDP).
If you are looking for the Kong process error file (which is the nginx error file), you can find it at the following path:
{prefix}/logs/error.log