Document updated on Feb 3, 2023
Jaeger Telemetry Integration - KrakenD API Gateway
The KrakenD exporter to Jaeger allows you to submit spans to an OpenTelemetry Collector (HTTP or gRPC) automatically.
Jaeger is an open-source, end-to-end distributed tracing system that allows you to monitor and troubleshoot transactions in complex distributed systems. Use Jaeger when you want to see the complete flow of a user request through KrakenD and its connected services.
Jaeger configuration
To add Jaeger, configure a new exporter to the OpenTelemetry settings. For instance:
{
"version": 3,
"extra_config": {
"telemetry/opentelemetry": {
"service_name": "my_krakend_service",
"metric_reporting_period": 1,
"trace_sample_rate": 0.15,
"layers": {
"global": {
"report_headers": true
},
"proxy": {
"report_headers": true
},
"backend": {
"metrics": {
"disable_stage": true
},
"traces": {
"disable_stage": false,
"round_trip": true,
"read_payload": true,
"detailed_connection": true,
"report_headers": true
}
}
},
"exporters": {
"otlp": [
{
"name": "local_jaeger",
"host": "jaeger",
"port": 4317,
"use_http": false,
"disable_metrics": true
}
]
}
}
}
}
The fields relative to the exporter are:
Fields of "telemetry/opentelemetry": { "exporters":{} }
otlparray- The list of OTLP exporters you want to use. Set at least one object to push metrics and traces to an external collector using OTLP.Each item of otlp accepts the following properties:
custom_metric_reporting_periodinteger- Whether you want to override the global
metric_reporting_periodattribute set for all exporters or not. Value in seconds. A missing attribute, or set to0means using whatever value was used inmetric_reporting_periodat the global level.Defaults to0 disable_metricsboolean- Disable metrics in this exporter (leaving only traces if any). It won’t report any metrics when the flag is
true.Defaults tofalse disable_tracesboolean- Disable traces in this exporter (leaving only metrics if any). It won’t report any metrics when the flag is
true.Defaults tofalse host* string- The host where you want to push the data. It can be a sidecar or a remote collector.
name* string- A unique name to identify this exporter.Examples:
"local_prometheus","remote_grafana" portinteger- A custom port to send the data. The port defaults to 4317 for gRPC unless you enable
use_http, which defaults to 4318.Defaults to4317 use_httpboolean- Whether this exporter uses HTTP instead of gRPC.
But as you can see there is a layers attribute in the example configuration that defines settings for all exporters (not only Jaeger). See the layers options.
Also notice that port 4317 and "use_http": false are set, meaning that gRPC communication is used. Change to 4318 and the flag to true for HTTP communication.
Jaeger demo environment
You can test this setup by running the All in One official Jaeger image and opening the necessary ports. For instance:
version: "3"
services:
krakend:
image: krakend:2.10
volumes:
- "./:/etc/krakend"
ports:
- "8080:8080"
jaeger:
image: jaegertracing/all-in-one:1.54
environment:
COLLECTOR_ZIPKIN_HOST_PORT: ":9411"
ports:
- "5778:5778" # serve configs
- "16686:16686" # serve frontend UI
- "4317:4317" # otlp grpc: we remap this to be able to run other envs
- "4318:4318" # otlp http: we remap this to be able to run other envs
deploy:
resources:
limits:
memory: 4096M # Adjust according to your setup
