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

# Metrics

Session Management Controller (SMC) exposes metrics in the Prometheus format on the `/metrics` endpoint on port `8000`.

## GTP path

The GTP path metrics expose information about GTP-C messages and contexts.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| gtp_path_rtt_milliseconds | HISTOGRAM | name, peer_address, remote (deprecated), version, type | GTP path round trip time. Prometheus histogram buckets are: `[10, 30, 50, 75, 100, 1000, 2000]`. |
| gtp_path_messages_processed_total | COUNTER | name, peer_address, ip (deprecated), direction, version, type | Total number of GTP messages processed on a path |
| gtp_path_messages_duplicates_total | COUNTER | name, peer_address, remote (deprecated), version, type | Total number of duplicated GTP messages received on a path |
| gtp_path_messages_retransmits_total | COUNTER | name, peer_address, remote (deprecated), version, type | Total number of retransmitted GTP messages on a path |
| gtp_path_messages_timeouts_total | COUNTER | name, peer_address, remote (deprecated), version, type | Total number of timed out GTP messages on a path |
| gtp_path_contexts_total | GAUGE | name, peer_address, ip (deprecated), version | Total number of GTP contexts on a path |

> **NOTE**: The `remote`/`ip` and `peer_address` labels carry the same information (remote IP of the GTP peer). However, the `remote` and `ip` labels are deprecated. Use `peer_address` instead in your dashboards.

GTP path metrics contain the following labels:
- `name` - socket name
- `version` - GTP protocol version, either `v1` or `v2`
- `peer_address` - remote IP of the GTP peer
- `remote` (deprecated) - remote IP of the GTP peer
- `ip` (deprecated) - remote IP of the GTP peer
- `type` - GTP message type
- `direction` - GTP message direction, either `rx` for receive messages or `tx` for transmit messages

## GTP-C socket

The GTP-C socket metrics expose detailed information about GTP-C messages.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| gtp_c_socket_request_duration_microseconds | HISTOGRAM | name, version, type | GTP request execution time. Prometheus histogram buckets are: `[100, 300, 500, 750, 1000]`. |
| gtp_c_socket_messages_processed_total | COUNTER | name, direction, version, type | Number of GTP messages processed on a socket |
| gtp_c_socket_messages_duplicates_total | COUNTER | name, version, type | Number of duplicated GTP messages received on a socket |
| gtp_c_socket_messages_retransmits_total | COUNTER | name, version, type | Number of retransmitted GTP messages on a socket |
| gtp_c_socket_messages_timeouts_total | COUNTER | name, version, type | Number of timed out GTP messages on a socket |
| gtp_c_socket_messages_replies_total | COUNTER | name, direction, version, type, result | Number of reply GTP messages on a socket |
| gtp_c_socket_errors_total | COUNTER | name, direction, error | Number of GTP errors on a socket |

GTP-C socket metrics contain the following labels:
- `name` - socket name
- `version` - GTP protocol version, either `v1` or `v2`
- `type` - GTP message type. Message types for GTPv1 are listed in 3GPP TS 29.060, Section 7.1 "Message Formats", Table 1: "Messages in GTP". Message types for GTPv2 are listed in 3GPP TS 29.274, Section 6.1.0 "Message Type", Table 6.1-1: "Message types for GTPv2".
- `direction` - GTP message direction, either `rx` for receive messages or `tx` for transmit messages
- `result` - GTP cause information element. Cause values for GTPv1 are listed in 3GPP TS 29.060, Section 7.7.1 "Cause". Cause values for GTPv2 are listed in 3GPP TS 29.274, Section 8.4 "Cause".
- `error` - type of error, either `malformed-requests` or ` version-not-supported`

## GTP-U socket

The GTP-C socket metrics expose detailed information about GTP-U messages.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| gtp_u_socket_messages_processed_total | COUNTER | name, direction, version, type | Number of GTP messages processed on a socket |

GTP-U socket metrics contain the following labels:
- `name` - socket name
- `direction` - GTP message direction, either `rx` for receive messages or `tx` for transmit messages
- `version` - GTP protocol version, either `v1` or `v2`
- `type` - GTP message type

## PCC rule metrics

The PCC rule metrics expose information about PCC rule usage in sessions.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| pcc_rule_users_total | GAUGE | rulename | Number of sessions that use the rule specified by the `rulename` |

## Sx PFCP

The Sx PFCP metrics expose information about PFCP messages, peers, and associations.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| pfcp_messages_processed_total | COUNTER | name, remote, direction, type | Number of PFCP messages processed |
| pfcp_messages_duplicates_total | COUNTER | name, remote, type | Number of duplicated PFCP messages received |
| pfcp_messages_retransmits_total | COUNTER | name, remote, type | Number of retransmitted PFCP messages |
| pfcp_messages_timeouts_total | COUNTER | name, remote, type | Number of timed out PFCP messages |
| pfcp_messages_replies_total | COUNTER | name, remote, direction, type, result | Number of reply PFCP messages |
| pfcp_errors_total | COUNTER | name, remote, direction, type | Number of PFCP errors |
| pfcp_peer_response_milliseconds | HISTOGRAM | name, remote, type | PFCP round trip time. Prometheus histogram buckets are: `[100, 300, 500, 750, 1000]`. |
| pfcp_request_duration_microseconds | HISTOGRAM | name, type | PFCP request execution time. Prometheus histogram buckets are: `[100, 300, 500, 750, 1000]`. |
| pfcp_sx_association_total | GAUGE | state | Number of associated GTP-U instances |
| pfcp_sx_context_total | GAUGE | name | Number of Sx session contexts |

Sx PFCP metrics contain the following labels:
- `name` - socket name
- `remote` - remote IP
- `direction` - PFCP message direction, either `rx` for receive messages or `tx` for transmit messages
- `type` - PFCP message type
- `result` - PFCP cause information element
- `rulename` - name of the rule
- `state` - state of the PFCP association, the value is `up`

## Termination causes

The Termination causes metrics expose information about the reasons for dialogue termination in different interfaces.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| termination_cause_total | COUNTER | api, reason | Number of termination causes |

Termination cause metrics contain the following labels:
- `api` - SMC interface to which a termination cause relates, can be either `gn/gp`, `s5/s8`, `s11`, or `tdf`
- `reason` - the reason for a termination cause

## IP pool

The IP pool metrics expose information about IP usage in pools.

| Metric | Type | Labels | Description |
|:--- |:---|:---| ---|
| ergw_local_pool_free | GAUGE | name, type, id | Number of free addresses |
| ergw_local_pool_used | GAUGE | name, type, id | Number of used addresses |

IP pool metrics contain the following labels:
- `name` - IP pool name
- `type` - type of IP addresses allocated from the pool, can be either `ipv4` or `ipv6`
- `id` - the first address in the pool

## Diameter metrics

The Diameter metrics expose information about Diameter AAA sessions and Diameter requests.

| Metric | Type | Labels | Description |
|:---|:---|:---|---|
| aaa_sessions_total | GAUGE | handler, state | Number of active AAA sessions |
| ergw_aaa_diameter_outstanding_requests | GAUGE | name, type | Number of outstanding requests (unanswered and not timed out) |
| ergw_aaa_diameter_available_tokens | GAUGE | name, type | Number of available tokens |
| ergw_aaa_diameter_no_tokens_available_total | COUNTER | name | Number of times a request to a peer was aborted because no tokens were left |
| ergw_aaa_diameter_no_capacity_left_total | COUNTER | name | Number of times a request to a peer was aborted because the maximum number of outstanding requests was reached |

> **NOTE**: For more details on how SMC handles tokens and outstanding requests in Diameter connections, read the [charging configuration guide](https://docs.cennso.com/components/smc/3.12/config/charging.md#diameter-rate-control).

Diameter metrics contain the following labels:
- `handler` - the specific application of the AAA session. The possible values are: `ergw_aaa_ro` (Diameter online charging), `ergw_aaa_rf` (Diameter offline charging), `ergw_aaa_gx` (Diameter policy management), and `ergw_aaa_nasreq` (Diameter NASREQ).
- `state` - the state of the AAA session. The only possible value is `started` for all handlers except `ergw_aaa_ro`. For the `ergw_aaa_ro` handler, the possible values are `started` and `ocs_hold`. The `ocs_hold` value refers to the [OCS Free](https://docs.cennso.com/components/smc/3.12/config/charging.md#ocs-free) feature.
- `name` - name of the Diameter AAA service. The possible values are: `Gx`, `PPE`, `Default`, `Rf`, `Gy`, and `nasreq`.
- `type` - specifies whether the metric shows the currently observed value of outstanding requests (then the value of this label is `used`) or the configured limit of the allowed tokens/outstanding requests (then the value of this label is `limit`).

## RADIUS metrics

SMC usually acts as a RADIUS client in AAA sessions. However, it can receive CoA or Disconnect messages as a server. Both roles have their own set of metrics as described below, apart from common AAA session metrics.

### `ergw_aaa` RADIUS metrics

The `ergw_aaa` RADIUS metrics expose information about RADIUS AAA sessions.

| Metric | Type | Labels | Description |
|:---|:---|:---|---|
| aaa_sessions_total | GAUGE | handler, state | Number of active AAA sessions |

- `handler` - the specific application of the AAA session. The only possible value is `ergw_aaa_radius` (RADIUS NAS).
- `state` - the state of the AAA session. The only possible value is `started`.

### `eradius` server metrics

The `eradius` server metrics expose information about incoming Disconnect and CoA requests.

| Metric | Labels | Type | Description |
| ---|---|---| --- |
| eradius_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, port, nas_id, nas_ip | Duration of RADIUS requests served by SMC |
| eradius_coa_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, port, nas_id, nas_ip | Duration of RADIUS CoA requests served by SMC |
| eradius_disconnect_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, port, nas_id, nas_ip | Duration of RADIUS Disconnect requests served by SMC |

- `server_name` - internal name of the SMC RADIUS server. The value is `disc_coa`.
- `server_ip` - IP of the SMC RADIUS server. The value corresponds to the configuration property `<aaa.radius.disconnectRequest.client.addr>`.
- `server_port` - port of the SMC RADIUS server. The value corresponds to the configuration property `<aaa.radius.disconnectRequest.server.port>`.
- `nas_ip` - the NAS IP address of the RADIUS client sending requests to SMC. The value corresponds to the configuration property  `<aaa.radius.disconnectRequest.client.addr>`.
- `nas_id` -  the NAS identifier assigned to incoming RADIUS requests sent to SMC. The value is `server1_<aaa.radius.disconnectRequest.client.addr>`.

### `eradius` client metrics

The `eradius` client metrics expose information about outgoing RADIUS requests.

| Metric | Labels | Type | Description |
| ---|---| ---| --- |
| eradius_client_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS requests sent by SMC |
| eradius_client_reply_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS replies sent by SMC |
| eradius_client_access_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS Access requests sent by SMC |
| eradius_client_accounting_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS Accounting requests sent by SMC |
| eradius_client_coa_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS CoA requests sent by SMC |
| eradius_client_disconnect_request_duration_milliseconds | HISTOGRAM | server_name, server_ip, server_port, client_name, client_ip | Duration of RADIUS Disconnect requests sent by SMC |

- `server_name` - internal name of the SMC RADIUS client taken from the configuration property `<aaa.nasID>`. `NAS` if not present.
- `server_ip` - IP of the remote RADIUS server to which the SMC RADIUS client sends requests. The value corresponds to the resolved IP of the configuration property `<aaa.radius.server.host>`.
- `server_port` - port of the remote RADIUS server to which the SMC RADIUS client sends requests. The value corresponds to the resolved IP of the configuration property `<aaa.radius.server.port>`
- `client_name` - internal name of the SMC RADIUS client taken from the configuration property `<aaa.nasID>`. `NAS` if not present.
- `client_ip` - this label is not used and its only possible value is `undefined`.

## Erlang VM metrics

Session Management Controller exposes [Erlang VM-specific](https://github.com/deadtrickster/prometheus.erl#erlang-vm--otp-collectors) metrics. They show the state of the Erlang VM, such as memory usage, run queues for the different threads, etc. The metrics provide information on VM-level problems that may not be apparent from application-specific metrics, and that relate to non-functional bugs like poor performance or memory leaks.
