Search…
Kong
The topic provides information on Traceable's Kong community version agent. Traceable supports both database and dbless mode with its agent.
Traceable provides a plugin for your Kong API gateway deployment. This document details the configurations for the Kong community version 1.4x or higher.

Prerequisites

Make sure that the following prerequisites are met before deploying Traceable's Kong tracing agent or Kong agent:
    unzip installed on the host OS
    Kong API gateway 1.4 or higher is installed
    Traceable agent is installed and configured. For more information on Traceable agent installation, see Traceable agent.
    Lua Rocks CLI is installed.
    IP address of machine where Traceable agent is running.

Download

Traceable provides the Kong agent using Lua Rocks package manager. It is therefore essential that Lua Rocks is preinstalled as mentioned in the prerequisites. You can download the Kong agent by entering the following command:
1
luarocks install kong-plugin-traceable
Copied!

Configuration

Load the traceable and zipkin plugins by defining them in /etc/kong/kong.conf
1
plugins = bundled,traceable,zipkin
Copied!

Restart Kong

1
kong restart
Copied!

Database mode

If you are running the Traceable agent with Kong's database mode, complete the following steps to configure the agent in the database mode:
    1.
    Configure Traceable agent:
Replace <WORKSPACE> with the workspace you wish to protect with Traceable and <HOSTNAME> with the hostname or ip hosting the Traceable Platform Agent
1
curl -X POST http://localhost:8001/<WORKSPACE>/plugins/ \
2
--data "name=traceable" \
3
--data config.ext_cap_endpoint=http://<HOSTNAME>:5442
Copied!
2. Configure Zipkin plugin
Replace <WORKSPACE> with the workspace you wish to protect with Traceable and <HOSTNAME> with the hostname or ip hosting the Traceable Platform Agent
1
curl -X POST http://localhost:8001/<WORKSPACE>/plugins/ \
2
--data "name=zipkin" \
3
--data "config.http_endpoint=http://<HOSTNAME>:9411/api/v2/spans" \
4
--data "config.sample_ratio=1.0" \
5
--data "config.include_credential=true" \
6
--data "config.traceid_byte_count=16" \
7
--data "config.header_type=preserve"
Copied!
The following table gives a brief explanation of the various options.
Option
Description
name
The name of the plugin to use. Use zipkin here.
http_endpoint
The endpoint to which Zipkin spans are sent by Kong. In this case the endpoint is Traceable agent host machine.
sample_ratio
Defines how often to sample requests that do not contain trace IDs. The value can be between 0 and 1, both values included. Set to 0 to turn off sampling, set it to 1 to sample all the requests.
include_credential
Set to true if you want to include the credential metadata of currently authenticated user to be sent to Zipkin.
traceid_byte_count
The length in bytes of each requests Trace ID. The values can be either 8 or 16.
header_type
The type of header the agent expects.

dbless mode

If your Kong is deployed in a dbless mode, you can configure the Traceable agent by editing yourkong.yml file. Add the following section in your kong.yml file:
1
plugins:
2
- name: traceable
3
config:
4
ext_cap_endpoint: "http://localhost:5442"
5
- name: zipkin
6
config:
7
http_endpoint: "http://<HOSTNAME>:9411/api/v2/spans"
8
sample_ratio: 1.0
9
include_credential: true
10
traceid_byte_count: 16
11
header_type: "TRACECONTEXT"
12
Copied!
Restart the Kong service after your have updated kong.yml file.
Last modified 2mo ago