Kong Gateway monitoring

To enable Kong Observability in Dynatrace, you have the following options.

  • recommended Enable OneAgent for Gateway logs, traces, and process monitoring. This should be combined with Dynatrace Prometheus scraping to monitor Kong Gateway metrics.
  • Monitor Kong using a combination of OpenTelemetry for traces and Prometheus for Kong Gateway metrics.

Kong Gateway process and logs

OneAgent automatically monitors the Kong Gateway process and logs.

Prerequisites

  • Kong Gateway version 2.8+
  • OneAgent or Dynatrace Operator is installed and available for monitoring your Kong Gateway.

The required installation depends on your application:

If your application is running
See the instruction for
on a virtual machine or bare-metal
as workload in Kubernetes or OpenShift

Application traces

In addition to process and logs, OneAgent also provides Kong Gateway application traces. See Manual runtime instrumentation for NGINX.

Metrics

Kong’s Prometheus plugin is a convenient way to collect Kong Gateway metrics. Dynatrace can collect these metrics directly from the Gateway produced by the Kong plugin. The default port and endpoint is 8001/metrics.

For more information and a list of available metrics, see the Kong Prometheus plugin documentation.

Step 1 Enable Kong Prometheus plugin

Basic configuration

To enable basic configuration of the Kong Prometheus plugin send a POST request replacing {HOST} with the host name value.

curl -s -X POST http://{HOST}:8001/plugins \
-H 'Content-Type: application/json' \
-d '{
"name": "prometheus"
}'

Additional plugin metrics

To enable additional metrics produced by the Kong Gateway Prometheus plugin, send a POST request replacing {HOST} and {PLUGIN-INSTANCE_NAME} with proper values:

curl -s -X POST http://{HOST}:8001/plugins \
-H 'Content-Type: application/json' \
-d '{
"name": "prometheus",
"instance_name": "{PLUGIN-INSTANCE_NAME}",
"config": {
"per_consumer": true,
"status_code_metrics": true,
"latency_metrics": true,
"bandwidth_metrics": true,
"upstream_health_metrics": true
}
}'

To check available Kong metrics, query the /metrics endpoint:

curl -i http://{HOST}:8001/metrics

Step 2 Collect Prometheus metrics

After configuring Kong Gateway's Prometheus plugin, metrics can be collected using the Dynatrace ActiveGate (recommended) or the OpenTelemetry Collector.

Scrape metrics using ActiveGate

In Kubernetes, Dynatrace supports scraping of Prometheus endpoints using special annotations.

To learn how to collect Prometheus metrics in Kubernetes, see Monitor Prometheus metrics.