---
title: HAProxy Metrics
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > OpenTelemetry in Datadog > Integrations > HAProxy Metrics
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# HAProxy Metrics

## Overview{% #overview %}

{% image
   source="https://docs.dd-static.net/images/opentelemetry/collector_exporter/haproxy_metrics.25ddb1705d2eb0ad0d935071577d3cf4.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/collector_exporter/haproxy_metrics.25ddb1705d2eb0ad0d935071577d3cf4.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="OpenTelemetry HAProxy metrics in an HAProxy dashboard" /%}

The [HAProxy receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/haproxyreceiver) collects HAProxy metrics that populate the [HAProxy Overview](https://app.datadoghq.com/dash/integration/28/haproxy---overview) dashboard.

For more information, see the OpenTelemetry project documentation for the [HAProxy receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/haproxyreceiver).

## Setup{% #setup %}

This example uses component identifiers from OpenTelemetry Collector Contrib v0.154.0. For other versions or distributions, use the identifiers your distribution supports.

Add the following lines to your Collector configuration. The receiver has no default endpoint, so set `endpoint` to the URL of your HAProxy stats page or the path to its stats socket, such as `/var/run/haproxy.sock`. Limit access to the stats page or socket, for example to localhost, because it shows details about your servers.

The `metrics` section turns on metrics that the receiver doesn't collect by default. The HAProxy dashboard uses them.

```yaml
receivers:
  haproxy:
    endpoint: http://127.0.0.1:8080/stats
    metrics:
      haproxy.connections.total:
        enabled: true
      haproxy.sessions.total:
        enabled: true
      haproxy.failed_checks:
        enabled: true
      haproxy.clients.canceled:
        enabled: true
      haproxy.compression.bypass:
        enabled: true
      haproxy.compression.count:
        enabled: true
      haproxy.compression.input:
        enabled: true
      haproxy.compression.output:
        enabled: true
```

Add `haproxy` to the `receivers` list of the metrics pipeline in your configuration. Keep the processors already in that pipeline. The Datadog OTLP metrics intake accepts only delta metrics, and this receiver produces cumulative sums, so the pipeline needs `cumulativetodelta`. The [recommended Collector setup](https://docs.datadoghq.com/opentelemetry/setup/collector_exporter.md) includes it.

For all configuration options, see the [HAProxy receiver documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/haproxyreceiver).

## Data collected{% #data-collected %}

| OTEL                          | DESCRIPTION                                                                                                                                                      | FILTER                             |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| haproxy.bytes.input           | Bytes in. Corresponds to HAProxy's `bin` metric.                                                                                                                 | `haproxy.service_name`: `FRONTEND` |
| haproxy.bytes.input           | Bytes in. Corresponds to HAProxy's `bin` metric.                                                                                                                 | `haproxy.service_name`: `BACKEND`  |
| haproxy.bytes.output          | Bytes out. Corresponds to HAProxy's `bout` metric.                                                                                                               | `haproxy.service_name`: `FRONTEND` |
| haproxy.bytes.output          | Bytes out. Corresponds to HAProxy's `bout` metric.                                                                                                               | `haproxy.service_name`: `BACKEND`  |
| haproxy.clients.canceled      | Number of data transfers aborted by the client. Corresponds to HAProxy's `cli_abrt` metric                                                                       |
| haproxy.compression.bypass    | Number of bytes that bypassed the HTTP compressor (CPU/BW limit). Corresponds to HAProxy's `comp_byp` metric.                                                    |
| haproxy.compression.count     | Number of HTTP responses that were compressed. Corresponds to HAProxy's `comp_rsp` metric.                                                                       |
| haproxy.compression.input     | Number of HTTP response bytes fed to the compressor. Corresponds to HAProxy's `comp_in` metric.                                                                  |
| haproxy.compression.output    | Number of HTTP response bytes emitted by the compressor. Corresponds to HAProxy's `comp_out` metric.                                                             |
| haproxy.connections.total     | Cumulative number of connections (frontend). Corresponds to HAProxy's `conn_tot` metric.                                                                         |
| haproxy.failed_checks         | Number of failed checks. (Only counts checks failed when the server is up). Corresponds to HAProxy's `chkfail` metric.                                           |
| haproxy.requests.denied       | Requests denied because of security concerns. Corresponds to HAProxy's `dreq` metric                                                                             | `haproxy.service_name`: `BACKEND`  |
| haproxy.requests.denied       | Requests denied because of security concerns. Corresponds to HAProxy's `dreq` metric                                                                             | `haproxy.service_name`: `FRONTEND` |
| haproxy.requests.errors       | Cumulative number of request errors. Corresponds to HAProxy's `ereq` metric.                                                                                     | `haproxy.service_name`: `FRONTEND` |
| haproxy.requests.total        | Total number of HTTP requests received. Corresponds to HAProxy's `req_tot`, `hrsp_1xx`, `hrsp_2xx`, `hrsp_3xx`, `hrsp_4xx`, `hrsp_5xx` and `hrsp_other` metrics. | `haproxy.service_name`: `FRONTEND` |
| haproxy.requests.total        | Total number of HTTP requests received. Corresponds to HAProxy's `req_tot`, `hrsp_1xx`, `hrsp_2xx`, `hrsp_3xx`, `hrsp_4xx`, `hrsp_5xx` and `hrsp_other` metrics. | `haproxy.service_name`: `BACKEND`  |
| haproxy.responses.denied      | Responses denied because of security concerns. Corresponds to HAProxy's `dresp` metric                                                                           | `haproxy.service_name`: `FRONTEND` |
| haproxy.responses.denied      | Responses denied because of security concerns. Corresponds to HAProxy's `dresp` metric                                                                           | `haproxy.service_name`: `BACKEND`  |
| haproxy.responses.errors      | Cumulative number of response errors. Corresponds to HAProxy's `eresp` metric, `srv_abrt` will be counted here also.                                             | `haproxy.service_name`: `BACKEND`  |
| haproxy.server_selected.total | Number of times a server was selected, either for new sessions or when re-dispatching. Corresponds to HAProxy's `lbtot` metric.                                  |
| haproxy.sessions.count        | Current sessions. Corresponds to HAProxy's `scur` metric.                                                                                                        |
| haproxy.sessions.total        | Cumulative number of sessions. Corresponds to HAProxy's `stot` metric.                                                                                           | `haproxy.service_name`: `BACKEND`  |
| haproxy.sessions.total        | Cumulative number of sessions. Corresponds to HAProxy's `stot` metric.                                                                                           | `haproxy.service_name`: `FRONTEND` |

For the full mapping between OpenTelemetry and Datadog metric names, see [OpenTelemetry Metrics Mapping](https://docs.datadoghq.com/opentelemetry/guide/metrics_mapping.md).

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Setting Up the OpenTelemetry Collector](https://docs.datadoghq.com/opentelemetry/collector_exporter.md)
