You are browsing documentation for an outdated plugin version.
Note: The OpenTelemetry plugin only works when Kong Gateway’s
opentelemetry_tracing
configuration is enabled.
The OpenTelemetry plugin is fully compatible with the OpenTelemetry specification and can be used with any OpenTelemetry compatible backend.
There are two ways to set up an OpenTelemetry backend:
- Using a OpenTelemetry compatible backend directly, like Jaeger (v1.35.0+) All the vendors supported by OpenTelemetry are listed in the OpenTelemetry’s Vendor support.
- Using the OpenTelemetry Collector, which is middleware that can be used to proxy OpenTelemetry spans to a compatible backend. You can view all the available OpenTelemetry Collector exporters at open-telemetry/opentelemetry-collector-contrib.
Set up Kong Gateway
The OpenTelemetry tracing capability supported by this plugin requires the following Kong Gateway configuration:
-
opentelemetry_tracing = all
: Enables all possible tracing instrumentations. Valid values can be found in Kong’s configuration reference. -
opentelemetry_tracing_sampling_rate = 1.0
: Tracing instrumentation sampling rate. Tracer samples a fixed percentage of all spans following the sampling rate. Set the sampling rate to a lower value to reduce the impact of the instrumentation on Kong Gateway’s proxy performance in production.
Set up an OpenTelemetry compatible backend
This section is optional if you are using a OpenTelemetry compatible APM vendor. All the supported vendors are listed in the OpenTelemetry’s Vendor support.
Jaeger natively supports OpenTelemetry starting with v1.35 and can be used with the OpenTelemetry plugin.
Deploy a Jaeger instance with Docker:
docker run --name jaeger \
-e COLLECTOR_OTLP_ENABLED=true \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
jaegertracing/all-in-one:1.36
-
The
COLLECTOR_OTLP_ENABLED
environment variable must be set totrue
to enable the OpenTelemetry Collector. -
The
4318
port is the OTLP/HTTP port and the4317
port is the OTLP/GRPC port that isn’t supported by the OpenTelemetry plugin yet.
Set up an OpenTelemetry Collector
This section is required if you are using an incompatible OpenTelemetry APM vendor.
Create a config file (otelcol.yaml
) for the OpenTelemetry Collector:
receivers:
otlp:
protocols:
grpc:
http:
processors:
batch:
exporters:
logging:
loglevel: debug
zipkin:
endpoint: "http://some.url:9411/api/v2/spans"
tls:
insecure: true
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, zipkin]
Run the OpenTelemetry Collector with Docker:
docker run --name opentelemetry-collector \
-p 4317:4317 \
-p 4318:4318 \
-p 55679:55679 \
-v $(pwd)/otelcol.yaml:/etc/otel-collector-config.yaml \
otel/opentelemetry-collector-contrib:0.52.0 \
--config=/etc/otel-collector-config.yaml
See the OpenTelemetry Collector documentation for more information.