Instana

 View Only

Monitoring Kong Gateway in Instana with StatsD

By Ajith Aravindan posted Wed December 21, 2022 12:48 AM

  


Kong Gateway is a lightweight, fast, and flexible cloud-native API gateway. An API gateway is a reverse proxy that lets you manage, configure, and route requests to your APIs.

StatsD is a network daemon that runs on the Node.js platform. It listens for statistics, like counters and timers, over UDP or TCP and sends aggregates to one or more pluggable backend services such as Graphite.

Instana Observability is a robust application performance monitoring solution. It helps you track performance and resolves incidents faster.

You can observe Kong Gateway in Instana with the help of StatsD. Let’s see how it works.

Architecture

The following diagram illustrates the overview of the setup:


Prerequisites

- Ensure that Kong Gateway is deployed and running.

- Ensure that the Instana agent is installed and running.

Check the following links for the official installation Instructions:

- Instana Agent

- Kong Gateway

Configurations

  1. The Instana agent acts as a StatsD collector daemon, and can receive metrics in the same way as a real StatsD daemon. So you don't need to start another StatsD daemon.

The StatsD sensor is disabled by default. To enable the sensor, edit the Instana agent configuration file <agent_install_dir>/etc/instana/configuration.yaml:


com.instana.plugin.statsd:
  enabled: true
  ports:
    udp: 8125
    mgmt: 8126
  bind-ip: "0.0.0.0" # all IPs by default
  flush-interval: 10 # in seconds

Note: The Instana agent is installed on the same host where Kong Gateway is running in this example. You can read more information on StatsD configuration here.


  1. Kong Gateway has support for many plugins, extending functionalities. The StatsD plugin is used to get the metrics from Kong Gateway.

Here the admin API is used to enable the StatsD plugin in Kong as follows:


curl -X POST http://localhost:8001/plugins/ \
    --data "name=statsd"  \
    --data "config.host=127.0.0.1" \
    --data "config.port=8125" \
    --data "config.allow_status_codes=200-205" \
    --data "config.allow_status_codes=400-499"

The above request will configure StatsD plugin in Kong to send the metrics to 127.0.0.1:8125 over UDP. Instana is listening on the same port for the statistics. You can read more information on the plugin configuration here.


Viewing metrics

Instana will display Kong Gateway metrics in the host dashboard as StatsD custom metrics.

A custom dashboard can be created to watch a subset of the reported metrics.

For example, you have configured a service named “example_service“ in Kong and a route under it, and you want to see request response latency of it in a chart. To achieve this, create a custom dashboard from the home page of Instana UI. Then, add a time series widget with StatsD latency metric.

For more information about custom dashboards, refer to the Instana official documentation here.

Summary

Now you have learned how to configure and observe Kong Gateway in Instana by using StatsD. You can visualize metrics that you are interested in by using the custom dashboard of Instana. I hope this is helpful to you. If you want to know more on Instana and Kong, refer to the following topics:


#Agent
0 comments
18 views

Permalink