How to use Kong Gateway to collect OpenTelemetry data for vFunction
Overview
To gather OpenTelemetry Traces through Kong’s Gateway requires enabling the Tracing Implementation in the Kong Gateway. See the steps below to use Kong Gateway with an application that is analyzed by vFunction.
Configure the Kong Gateway
Add the following parameters to the Kong Gateway’s kong.conf:
tracing_instrumentations = all
tracing_sampling_rate = 1.0
Enable the OpenTelemetry Plugin on each Kong Service
Make the following request to enable the Kong OpenTelemetry Plugin on each Service. Note that $YOUR_OTEL_COLLECTOR will need to be replaced with the actual name:
curl -X POST http://localhost:8001/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "opentelemetry",
"config": {
"traces_endpoint": "$YOUR_OTEL_COLLECTOR/api/v2/otlp/v1/traces",
"resource_attributes": {
"service.name": "kong-dev"
}
}
}
Enable vFunction on the OpenTelemetry Collector
Modify the OpenTelemetry Collector’s Configuration File, e.g. /etc/otelcol/config.yaml or the configMap for the Collector, to add the fields listed below to the file. Restart the Collector after making these changes.
- Find-and-replace $PROTOCOL with http or https depending on how the VF Server was configured
- Find-and-replace $VF_SERVER_ADDRESS with the URL for login to your organization’s vFunction Server
- Find-and-replace $VF_APP_UUID with the one provided by the VF Server UI in the Installation Instructions
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
exporters:
otlphttp/vf:
endpoint: $PROTOCOL://$VFSERVER/api/unauth/otlp
headers:
X-VF-APP: $VF_APP_UUID
service:
pipelines:
traces:
exporters: [otlphttp/vf]