Skip to main content

Kong

Send distributed traces from Kong to Levitate using OpenTelemetry

Introduction

This guide will help you integrate Kong with Levitate to monitor and improve the observability of your API gateway. This document provides step by step instructions to start collecting traces using Kong's OpenTelemetry plugin.

Prerequisites

  1. Kong (version 2.0 or above)
  2. Levitate OpenTelemetry endpoint credentials from the Integrations page
    • levitate_otlp_endpoint
    • levitate_otlp_auth_header

Enable Distributed Tracing in Kong

  1. Enable tracing instrumentation

    Set the environment variable KONG_TRACING_INSTRUMENTATIONS="all" and restart Kong. More Kong configuration options available here.

  2. Enable the OpenTelemetry Plugin

    Add the OpenTelemetry plugin to your Kong configuration file or enable it via the Admin API. Here’s an example of how to enable the plugin globally via the Kong Admin API:

    curl -i -X POST http://<kong-admin-url>:8001/plugins \
    --data "name=opentelemetry" \
    --data "config.endpoint=http://<levitate_otlp_endpoint>" \
    --data "config.headers.Authorization=<levitate_otlp_auth_header>" \
    --data "config.service_name=kong"
    info

    The opentelemetry plugin sends trace to an OpenTelemetry compatible backend such as Levitate.

  3. Verify the Plugin is Enabled

    You can verify that the plugin is enabled by checking the Kong logs for trace data being sent to Levitate.

    tip

    Set environment variable KONG_LOG_LEVEL="debug" to verify traces are flowing in correctly to Levitate if needed.

Verify Traces in Levitate

Kong Traces in Levitate via OpenTelemetry

  • Log in to your Levitate account and navigate to the Grafana dashboard
  • Navigate to the traces dashboard to see the traces collected from Kong. You should see traces corresponding to your API requests, with detailed information about the request flow and latency

Troubleshooting

Please get in touch with us on Discord or Email if you have any questions.