> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cdf/4.0/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/cdf/4.0/observability/metrics.md).

# Metrics

Charging Data Function (CDF) exposes metrics in the [Prometheus](https://github.com/deadtrickster/prometheus.erl) format on the `/metrics` endpoint. To enable metrics, set these configuration options in the `values.yaml` file to `true`:

```yaml
http:
  enabled: true
  options:
    metrics: true
```

Most of the CDF metrics are default metrics from the [prometheus_cowboy library](https://github.com/deadtrickster/prometheus-cowboy).
DIAMETER metrics are exposed by [prometheus_diameter_collector](https://github.com/travelping/prometheus_diameter_collector).

In addition to overall CDF metrics, there are specific metrics for the CDF receiver and sender.

## CDF receiver metrics

To verify the status of CTF, check these metrics:

- [DIAMETER metrics](https://github.com/travelping/prometheus_diameter_collector). These metrics are only available for the receiver.
- Metrics related to connected peers
- Metrics indicating whether the charging data (ACR) is arriving

ACR start records are not used to generate CDRs for CGF; only interim and stop records are used.

This table presents metrics for CDF receiver.

| Name | Type | Labels | Metric
:---|:---|:---|:---
| ercdf\_cdr\_added\_total | counter | NodeID | Number of ACRs received from CTF and saved as CDR |
| ercdf\_nats\_error\_total | counter | NodeID, function | Number of NATS errors |
| ercdf\_ctf\_peers | gauge | ip | Number of CTF peers |

- The **NodeID** label specifies the node ID.
- The **ip** label consists of both the IP address and the port.
- The **function** label indicates the name of the function that failed. For example, its value can be `request`.

## CDF sender metrics

| Name | Type | Labels | Metric |
| :--- | :--- | :---| :---|
| ercdf\_cdr\_from\_nats\_total | counter | | Number of CDRs sent from NATS to CDF sender |
| ercdf\_cdr\_response\_ok\_total | counter | ip | Number of CDRs responded as success by CGF |
| ercdf\_cdr\_response\_lost\_total | counter | ip | Number of CDRs not responded by CGF |
| ercdf\_cdr\_sent\_error\_total | counter | ip | Number of CDRs not possible to send to CGF |
| ercdf\_cdr\_outstanding\_send | gauge | ip | Processes that have sent CDR to CGF and are waiting for response or timeout |
| ercdf\_cgf\_peers | gauge | ip | Number of CGF peers |
| ercdf\_gtp\_prime\_total | counter | port, ip_address, name | Number of GTP packets sent to/received from CGF |

- The **ip_address** label specifies the IP address.
- The **port** label specifies the IP port.
- The **ip** label consists of both the IP address and the port.
- The **name** label specifies the GTP prime packet name, for example: `echo_request` or `data_response`.
