Set up Dynatrace with OpenTelemetry

Premium Partner
Uses: Kong Gateway decK
Related Resources
Minimum Version
Kong Gateway - 3.8
TL;DR

You can use the OpenTelemetry plugin with Dynatrace SaaS to send analytics and monitoring data to Dynatrace dashboards. Set KONG_TRACING_INSTRUMENTATIONS=all and KONG_TRACING_SAMPLING_RATE=1.0. Enable the OTEL plugin with your Dynatrace tracing and log endpoint, specify the name you want to track the traces by in resource_attributes.service.name, and add the Dynatrace API token as an Authorization header.

Prerequisites

Set the following Dynatrace tracing variables before you configure the Data Plane:

export KONG_TRACING_INSTRUMENTATIONS=all
export KONG_TRACING_SAMPLING_RATE=1.0
Copied to clipboard!

Enable the OTEL plugin

In this tutorial, we’ll be configuring the OpenTelemetry plugin to send Kong Gateway traces and logs to Dynatrace SaaS. This configuration is good for testing purposes, but we recommend using a collector, like Dynatrace Collector, in production environments.

Enable the OTEL plugin with Dynatrace settings configured:

echo '
_format_version: "3.0"
plugins:
  - name: opentelemetry
    config:
      traces_endpoint: https://${{ env "DECK_DYNATRACE_ENVIRONMENT_ID" }}.live.dynatrace.com/api/v2/otlp/v1/traces
      logs_endpoint: https://${{ env "DECK_DYNATRACE_ENVIRONMENT_ID" }}.live.dynatrace.com/api/v2/otlp/v1/logs
      resource_attributes:
        service.name: kong-dev
      headers:
        Authorization: Api-Token ${{ env "DECK_DYNATRACE_API_TOKEN" }}
' | deck gateway apply -
Copied to clipboard!

Validate

Send a POST request to generate traffic that we can use to validate that Dynatrace is receiving the traces:

 curl -X POST "$KONNECT_PROXY_URL/anything" \
     -H "Accept: application/json"\
     -H "Content-Type: application/json"
Copied to clipboard!

In the Dynatrace UI, navigate to Distributed Traces and search for Service name of kong-dev. You should see a trace for the request you just sent. Sometimes it can take a few seconds to display.

Cleanup

If you created a new control plane and want to conserve your free trial credits or avoid unnecessary charges, delete the new control plane used in this tutorial.

FAQs

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!