OpenTelemetry
Install the HAProxy OpenTelemetry filter
This page applies to:
- HAProxy 3.4 and newer
- HAProxy Enterprise 3.2r1 and newer
To begin collecting OpenTelemetry data from your load balancer, you must install the filter. This page describe the steps.
It also explains how to run OpenTelemetry Collector to test your installation. OpenTelemetry Collector is suitable for test and production environments, although in production you’ll want to run it on a separate server from your load balancer. It can print telemetry data to the console so you can quickly verify that everything works. Or use it to relay data to other software such as Jaeger and Prometheus, which let you visualize traces, metrics, and logs.
Install the OpenTelemetry filter Jump to heading
Installing the HAProxy OpenTelemetry filter varies depending on the product. The table below tells you where to go.
| Product | Install steps |
|---|---|
| HAProxy | The filter is included in the HAProxy OpenTelemetry C library. Compile HAProxy from source while including the HAProxy OpenTelemetry library. This library depends on the HAProxy C Wrapper library and the OpenTelemetry C++ client library. For compilation steps, see the HAProxy OpenTelemetry GitHub project. |
| HAProxy Enterprise | The filter is part of the HAProxy Enterprise OpenTelemetry module. See the OpenTelemetry module guide. |
Once installed, you can run OpenTelemetry Collector to verify that everything works. Also, check out the tutorials to learn how to configure traces, logs, and metrics.
Run OpenTelemetry Collector Jump to heading
OpenTelemetry Collector provides a vendor-agnostic way to receive, process, and export telemetry data. You can send your traces, logs, and metrics to it to see the data as it streams in. Simply configure its debug exporter, which prints to the console. Or, configure Collector to relay data to any software that supports the OpenTelemetry protocol, including Elasticsearch, Jaeger, Prometheus, and others. For a full list, see the OpenTelemetry Registry.
In this tutorial, we’ll run OpenTelemetry Collector by using Docker Compose.
-
Install Docker and Docker Compose by following the official guide, Install Docker Engine.
-
Create a Docker Compose file that runs OpenTelemetry Collector as a container. In this example, we expose it at port 4318. Also, we run Jaeger and Prometheus as containers to provide destinations for traces and metrics.
docker-compose.yamlyamlnetworks:custom_net:driver: bridgeipam:config:- subnet: 172.16.0.0/16gateway: 172.16.0.1services:otel-collector:image: otel/opentelemetry-collectorvolumes:- ./collector-config.yaml:/etc/otelcol/config.yamlports:- 4318:4318 # OTLP http receivernetworks:custom_net:ipv4_address: 172.16.0.12# Send traces to Jaeger at 172.16.0.13:4318jaeger:image: jaegertracing/jaegerports:- "16686:16686"- "16687:16687"environment:- LOG_LEVEL=debugnetworks:custom_net:ipv4_address: 172.16.0.13# Send metrics to Prometheus at 172.16.0.14:9090prometheus:image: prom/prometheusports:- "9090:9090"volumes:- "./prometheus.yaml:/etc/prometheus/prometheus.yml"networks:custom_net:ipv4_address: 172.16.0.14docker-compose.yamlyamlnetworks:custom_net:driver: bridgeipam:config:- subnet: 172.16.0.0/16gateway: 172.16.0.1services:otel-collector:image: otel/opentelemetry-collectorvolumes:- ./collector-config.yaml:/etc/otelcol/config.yamlports:- 4318:4318 # OTLP http receivernetworks:custom_net:ipv4_address: 172.16.0.12# Send traces to Jaeger at 172.16.0.13:4318jaeger:image: jaegertracing/jaegerports:- "16686:16686"- "16687:16687"environment:- LOG_LEVEL=debugnetworks:custom_net:ipv4_address: 172.16.0.13# Send metrics to Prometheus at 172.16.0.14:9090prometheus:image: prom/prometheusports:- "9090:9090"volumes:- "./prometheus.yaml:/etc/prometheus/prometheus.yml"networks:custom_net:ipv4_address: 172.16.0.14 -
Create configuration files in the same directory as the
docker-compose.yamlfile.-
For OpenTelemetry Collector, create a file named
collector-config.yaml.collector-config.yamlyamlreceivers:otlp:protocols:http:endpoint: 0.0.0.0:4318exporters:debug:verbosity: detailedotlp_http:# The base URL of your OTLP/HTTP compatible backend (e.g., Jaeger)endpoint: "http://172.16.0.13:4318"prometheus:# publish Prometheus metrics to be scrapedendpoint: "0.0.0.0:9090"service:pipelines:traces:receivers: [otlp]exporters: [debug, otlp_http]metrics:receivers: [otlp]exporters: [debug, prometheus]logs:receivers: [otlp]exporters: [debug]collector-config.yamlyamlreceivers:otlp:protocols:http:endpoint: 0.0.0.0:4318exporters:debug:verbosity: detailedotlp_http:# The base URL of your OTLP/HTTP compatible backend (e.g., Jaeger)endpoint: "http://172.16.0.13:4318"prometheus:# publish Prometheus metrics to be scrapedendpoint: "0.0.0.0:9090"service:pipelines:traces:receivers: [otlp]exporters: [debug, otlp_http]metrics:receivers: [otlp]exporters: [debug, prometheus]logs:receivers: [otlp]exporters: [debug] -
For Prometheus, create a file named
prometheus.yaml.prometheus.yamlyaml# my global configglobal:scrape_interval: 15s # Scrape every 15 seconds. Default is every 1 minute.scrape_configs:- job_name: "prometheus"static_configs:- targets: ["localhost:9090"]- job_name: "opentelemetry"scheme: httpstatic_configs:- targets: ['172.16.0.12:9090']prometheus.yamlyaml# my global configglobal:scrape_interval: 15s # Scrape every 15 seconds. Default is every 1 minute.scrape_configs:- job_name: "prometheus"static_configs:- targets: ["localhost:9090"]- job_name: "opentelemetry"scheme: httpstatic_configs:- targets: ['172.16.0.12:9090']
-
-
Start the containers.
nixsudo docker compose upnixsudo docker compose upOnce the containers are running, you can see the OpenTelemetry Collector’s debug log in the console; the Jaeger UI listens at HTTP port 16686 and the Prometheus UI listens at port 9090. You won’t see metrics until you add them to your
instrumentation.cfgfile.