Monitoring Kong API Gateway

After you install the Instana host agent, the Kong API Gateway sensor is automatically installed. You can view the metrics that are related to Kong API Gateway in the Instana UI after you configure the sensor as outlined in the Configuring section of this topic.

Supported information

Supported operating systems

The supported operating systems of the Kong API Gateway sensor are consistent with host agents requirements, which can be checked in the Supported operating systems section of each host agent, such as Supported operating systems for Unix.

Supported versions

Instana agent supports the following Kong API Gateway versions:

  • Kong Gateway (OSS) 2.6 or later
  • Kong Gateway 2.6 or later (in Free or Enterprise mode)

Prerequisites

Review the prerequisites before you configure the Kong API Gateway sensor.

Standalone mode

Make sure that the Kong Admin API is accessible from the host where the agent is installed. In the kong.conf file, update the admin_listen parameter as shown in the following example:

admin_listen = 0.0.0.0:8001 reuseport backlog=16384, 0.0.0.0:8444 http2 ssl reuseport backlog=16384

In interface binding, the IP address 127.0.0.1 indicates that the server listens only to the loopback interface. Binding the server to the IP address 0.0.0.0 enables the server to accept traffic from all the available interfaces.

Hybrid mode

Instana supports the hybrid mode architecture of Kong. Hybrid monitoring of the Kong API Gateway is achieved by automatically discovering the Kong process. No entry is necessary in the configuration.yaml file. By default, the control plane port is set to 8001 and the data plane port is set to 8100.

Basic authentication

The Kong Instana sensor supports basic authentication. To configure Kong basic authentication, see the instructions. If the Kong admin API does not require basic authentication, then you can skip this step.

The following configuration is applicable only if the basic authentication is enabled. Otherwise, do not update the configuration and keep it commented.

      username: ''  # Optional. Only for basic authentication otherwise keep it commented.
      password: '' # Optional. Only for basic authentication otherwise keep it commented.
      admin_api_route_path: '' # Optional.Only for basic authentication otherwise keep it commented.

Kong-Admin-Token based authentication

Kong-Admin-Token based authentication assumes that Kong is secured with Role-Based Access Control (RBAC) and you created your Kong-Admin-Token. You must create Kong-Admin-Token before you issue admin API calls. To create and update your token in the Kong Enterprise Edition web console, click Profile > Reset Token. Token abc123 is created in the following example: If the Kong admin API does not require Kong-Admin-Token based authentication, then you can skip this step.

The following configuration is applicable only if the Kong-Admin-Token based authentication is enabled. Otherwise, do not update the configuration, and keep it commented.

      admin_token: 'abc123' # Optional. Only for Kong-Admin-Token based authentication otherwise keep it commented.

Configuring

The Kong API Gateway sensor supports both local and remote monitoring.

Local monitoring

Local monitoring of the Kong API Gateway is achieved by automatically discovering the Kong process. No entry is necessary in the configuration.yaml file. For more information about accessing the admin API in hybrid mode, see Hybrid Mode.

Remote monitoring

To connect to Kong API Gateway, configure the following fields in the agent configuration file <agent_install_dir>/etc/instana/configuration.yaml:

#Kong API Gateway
com.instana.plugin.kong:
  remote: # Multiple configurations can be specified
    - host: '' # Kong Server Host or IP address.
      port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
      availabilityZone: 'KongAZ' # default is 'KongAZ'
      poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
      protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
      username: ''  # Optional. Only for basic authentication otherwise keep it commented.
      password: '' # Optional. Only for basic authentication otherwise keep it commented.
      admin_api_route_path: '' # Optional.Only for basic authentication otherwise keep it commented.

The following example shows the configuration without basic authentication:

#Kong API Gateway
com.instana.plugin.kong:
  remote: # Multiple configurations can be specified
    - host: 'host-1' # Kong Server Host or IP address.
      port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
      availabilityZone: 'KongAZ-DC1' # default is 'KongAZ'
      poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
      protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
    - host: 'host-2' # Kong Server Host or IP address.
      port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
      availabilityZone: 'KongAZ-DC2' # default is 'KongAZ'
      poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
      protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.

The following example shows the configuration with basic authentication enabled:

#Kong API Gateway
com.instana.plugin.kong:
  remote: # Multiple configurations can be specified
    - host: 'host-1' # Kong Server Host or IP address.
      port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
      availabilityZone: 'KongAZ-DC1' # default is 'KongAZ'
      poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
      protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
      username: 'user-1'  # Optional. Only for basic authentication otherwise keep it commented.
      password: 'password-1' # Optional. Only for basic authentication otherwise keep it commented.
      admin_api_route_path: 'admin-api-1' # Optional.Only for basic authentication otherwise keep it commented.
    - host: 'host-2' # Kong Server Host or IP address.
      port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
      availabilityZone: 'KongAZ-DC2' # default is 'KongAZ'
      poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
      protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
      username: 'user-2'  # Optional. Only for basic authentication otherwise keep it commented.
      password: 'password-2' # Optional. Only for basic authentication otherwise keep it commented.
      admin_api_route_path: 'admin-api-2' # Optional.Only for basic authentication otherwise keep it commented.

Viewing metrics

To view the metrics, complete the following steps:

  1. In the sidebar of the Instana UI, select Infrastructure.
  2. Click a specific monitored host.

You can see a host dashboard with all the collected metrics and monitored processes.

The following metrics are available for each Kong API Gateway server:

Metric Description Granularity
Kong Datastore Reachable Displays the Kong data store connection status. Returns "No" if Kong is unable to connect to the data store, otherwise returns "Yes". 30 seconds
Total Number of Database Entities Shows the total number of entities in the Kong database. 30 seconds
Kong DB Entity Count Errors Measures the number of errors that are encountered during the measurement of total number of entities in the Kong database. 30 seconds
Errors in License Information Collection Displays the total number of errors that are encountered during the collection of license information. 30 seconds
Kong Nginx Metric Errors Increments the metric errors that are encountered on using the nginx-lua-prometheus library. This Lua library is used with Nginx to track metrics and display them on a separate web page to be pulled by Prometheus. 30 seconds
Worker Consistency Defines whether this node must rebuild its state synchronously or asynchronously. Accepted values are strict and eventual. 30 seconds
Worker State Update Frequency Defines how often the worker state changes are checked with a background job. The default value is 5 seconds. 30 seconds
Kong Nginx Timers Presents the total number of NGINX timers in running and pending state. 30 seconds
Total Traffic Shows the count of all status codes that are grouped by status code class (for example, 2xx, 3xx, 4xx, and 5xx) 30 seconds
Shared Dictionary Allocated Slabs Presents allocated slabs in bytes in a shared-memory dictionary to store large amounts of data. 30 seconds
Allocated Bytes in Worker Lua VM Shows the allocated memory in bytes in Worker Lua virtual machine. 30 seconds
Kong Nginx Total Requests Displays the total number of requests by subsystem like HTTP or stream. 30 seconds
Bandwidth (Bytes) Displays the total Bandwidth (egress or ingress) flowing through Kong in bytes. This metric is available per service and as a sum across all services. 30 seconds
Total HTTP Requests Displays the total number HTTP requests per service per route and per HTTP status code. 30 seconds
Kong Latency by Services Displays the latency that is added by Kong and enabled plug-ins for each service. 30 seconds
Kong Latency by Routes Displays the latency that is added by Kong and enabled plug-ins for each route. 30 seconds