> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cdf/latest/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/latest/observability/metrics.md).

# Metrics

CDF exposes metrics in Prometheus format on the `/metrics` endpoint. These metrics help you monitor the health and performance of the charging data collection system.

CDF provides metrics from several sources:

- **HTTP server metrics** - default metrics from the [prometheus_cowboy library](https://github.com/prometheus-erl/prometheus-cowboy/tree/master) for tracking HTTP requests and connections.
- **Diameter metrics** - metrics from [prometheus_diameter_collector](https://github.com/travelping/prometheus_diameter_collector) for monitoring Diameter Rf interface connections. These metrics are only available for CDF Receiver, as it uses Diameter Rf to receive ACRs from SMF.

In addition to overall CDF metrics, there are specific metrics for the CDF Receiver and CDF Sender.

## CDF Receiver metrics

CDF Receiver exposes these metrics to track the incoming ACRs, CDM operations, and peer connections:

| Name | Type | Labels | Description |
| :--- | :--- | :--- | :--- |
| **ercdf_cdr_added_total** | counter | `NodeID` | Number of ACRs received from SMF and saved as CDRs |
| **ercdf_nats_error_total** | counter | `NodeID`, `function` | Number of errors when publishing CDRs to CDM |
| **ercdf_ctf_peers** | gauge | `ip` | Number of connected SMF peers (Diameter Rf or Nchf interfaces) |
| **ercdf_nchf_request_duration_milliseconds** | histogram | `transport`, `action`, `response_status` | Request duration for Nchf charging events over HTTP/2 or CDMP (requires Nchf alpha API) |
| **ercdf_sessions_total** | gauge | - | Number of active sessions not yet released (requires Nchf alpha API) |

## CDF Sender metrics

CDF Sender exposes these metrics to track CDR delivery and CGF connectivity:

| Name | Type | Labels | Description |
| :--- | :--- | :--- | :--- |
| **ercdf_cdr_from_nats_total** | counter | - | Number of CDRs retrieved from CDM |
| **ercdf_cdr_response_ok_total** | counter | `ip` | Number of CDRs successfully acknowledged by CGF |
| **ercdf_cdr_response_lost_total** | counter | `ip` | Number of CDRs with no response from CGF (timeout) |
| **ercdf_cdr_sent_error_total** | counter | `ip` | Number of CDRs not sent to CGF |
| **ercdf_cdr_outstanding_send** | gauge | `ip` | Number of in-flight CDRs waiting for CGF response |
| **ercdf_cgf_peers** | gauge | `ip` | Number of connected CGF peers |
| **ercdf_gtp_prime_total** | counter | `port`, `ip_address`, `name` | Number of GTP prime packets (Echo Request/Response, Data Request/Response) exchanged with CGF |

## Labels

This section describes metric labels that provide additional context about the measured events:

- `NodeID` - node identifier from the charging session
- `ip_address` - IP address of the peer (SMF or CGF)
- `port` - port number of the peer
- `ip` - combined IP address and port in the format `address:port`
- `function` - operation that encountered an error (for example, `request`)
- `transport` - protocol used for charging events: `http` (HTTP/2) or `cdmp` (CDMP over HTTP/2)
- `action` - Nchf charging action: `create` (session start), `update` (interim), or `release` (session end)
- `response_status` - HTTP status code returned in the Nchf response
- `name` - GTP prime packet type: `echo_request`, `echo_response`, `data_request`, or `data_response`.
