Kong

Kong

Agent Check Agent Check

Supported OS Linux Mac OS Windows

Integrationv1.17.0

Overview

The Agent’s Kong check tracks total requests, response codes, client connections, and more.

Setup

Installation

The Kong check is included in the Datadog Agent package, so you don’t need to install anything else on your Kong servers.

Configuration

Host

To configure this check for an Agent running on a host:

Metric collection
  1. Add this configuration block to your kong.d/conf.yaml file in the conf.d/ folder at the root of your Agent’s configuration directory to start gathering your Kong Metrics. See the sample kong.d/conf.yaml for all available configuration options.

    init_config:
    
    instances:
      ## @param kong_status_url - string - required
      ## URL where Kong exposes its status.
      #
      - kong_status_url: http://localhost:8001/status/
    

    Alternatively, on Agent 7+ a more modern implementation can be used:

    init_config:
    
    instances:
      ## @param openmetrics_endpoint - string - required
      ## The URL exposing metrics in the OpenMetrics format.
      #
      - openmetrics_endpoint: http://localhost:8001/metrics
    
  2. Restart the Agent.

Log collection

Log collection is not supported for the Datadog site.

Available for Agent versions >6.0

Kong access logs are generated by NGINX, so the default location is the same as for NGINX files.

  1. Collecting logs is disabled by default in the Datadog Agent, enable it in your datadog.yaml file:

    logs_enabled: true
    
  2. Add this configuration block to your kong.d/conf.yaml file to start collecting your Kong Logs:

    logs:
      - type: file
        path: /var/log/nginx/access.log
        service: '<SERVICE>'
        source: kong
    
      - type: file
        path: /var/log/nginx/error.log
        service: '<SERVICE>'
        source: kong
    

    Change the path and service parameter values and configure them for your environment. See the sample kong.d/conf.yaml for all available configuration options.

  3. Restart the Agent.

Containerized

For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.

Metric collection
ParameterValue
<INTEGRATION_NAME>kong
<INIT_CONFIG>blank or {}
<INSTANCE_CONFIG>{"kong_status_url": "http://%%host%%:8001/status/"}
Log collection

Log collection is not supported for the Datadog site.

Available for Agent versions >6.0

Collecting logs is disabled by default in the Datadog Agent. To enable it, see Kubernetes log collection documentation.

ParameterValue
<LOG_CONFIG>{"source": "kong", "service": "<SERVICE_NAME>"}

Validation

Run the Agent’s status subcommand and look for kong under the Checks section.

Data Collected

Metrics

kong.bandwidth.count
(count)
The total bandwidth in bytes consumed per service/route in Kong
Shown as byte
kong.http.consumer.status.count
(count)
HTTP status codes for customer per service/route in Kong
Shown as request
kong.http.status.count
(count)
HTTP status codes per service/route in Kong
Shown as request
kong.latency.bucket
(count)
The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.latency.count
(count)
The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.latency.sum
(count)
The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.memory.lua.shared_dict.bytes
(gauge)
The allocated slabs in bytes in a shared_dict
Shown as byte
kong.memory.lua.shared_dict.total_bytes
(gauge)
The total capacity in bytes of a shared_dict
Shown as byte
kong.memory.workers.lua.vms.bytes
(gauge)
The allocated bytes in worker Lua VM
Shown as byte
kong.nginx.http.current_connections
(gauge)
The number of HTTP connections
Shown as connection
kong.nginx.stream.current_connections
(gauge)
The number of stream connections
Shown as connection
kong.stream.status.count
(count)
The stream status codes per service/route in Kong
Shown as request
kong.table.count
(gauge)
Total number of tables in the database.
Shown as table
kong.table.items
(gauge)
Number of items in each table of the database.
Shown as row
kong.connections_accepted
(gauge)
Total number of accepted client connections.
Shown as connection
kong.connections_active
(gauge)
Current number of active client connections including Waiting connections.
Shown as connection
kong.connections_handled
(gauge)
Total number of handled connections. (Same as accepts unless resource limits were reached).
Shown as connection
kong.connections_reading
(gauge)
Current number of connections where Kong is reading the request header.
Shown as connection
kong.connections_waiting
(gauge)
Current number of idle client connections waiting for a request.
Shown as connection
kong.connections_writing
(gauge)
Current number of connections where nginx is writing the response back to the client.
Shown as connection
kong.total_requests
(gauge)
Total number of client requests.
Shown as request

Events

The Kong check does not include any events.

Service Checks

kong.can_connect
Returns CRITICAL if the Agent is unable to connect to the Kong instance. Returns OK otherwise.
Statuses: ok, critical

kong.openmetrics.health
Returns CRITICAL if the Agent is unable to connect to the OpenMetrics endpoint, otherwise returns OK.
Statuses: ok, critical

kong.datastore.reachable
Returns CRITICAL if Kong is unable to connect to the datastore, otherwise returns OK.
Statuses: ok, critical

kong.upstream.target.health
Returns CRITICAL if the target is unhealthy, otherwise returns OK.
Statuses: ok, critical

Troubleshooting

Need help? Contact Datadog support.

Further Reading