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

# PCS sessions metrics

> [!TIP]
> TPOSS exposes these metrics only when it manages sessions, so they are absent in an HSS-only deployment if the **hss.enabled** configuration option is set to `true`. The **rating_group_total** counters are only available when `diameter.enabled = true` and `session.backend = mysql` are set.
>
> For the metrics endpoint, the export formats, and the conventions that apply to all the metrics, see the [Metrics](https://docs.cennso.com/components/tposs/latest/observability/metrics.md) document.

TPOSS exposes the following PCS sessions metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| sessions_GGSN | gauge | visitedNetworkMCC, visitedNetworkMNC, activeProfile | Total number of network sessions |
| sessions_scgTotal | gauge | | Total number of service sessions |
| sessions_scg | gauge | nas | Total number of service sessions with the given `nas` |
| sessions_imei_change | counter | | Number of changed IMEIs during the PGW authorization process |
| sessions_uli_used | counter | | Number of used 3GPP-User-Location-Info during the PGW authorization process |
| sessions_mccmnc_changed | counter | | Number of changed MCCs and MNCs during the PGW authorization process |
| sessions_charging_rules_changed | counter | | Number of changed charging rules during the service session authorization process |
| sessions_terminating_workers | gauge | | Number of processes that handle postponed termination of service sessions |
| rating_group_total | counter | rule | Total number of sessions per rating group (only for MySQL `session.backend`) |

Check these metrics to see how many subscribers TPOSS serves at the moment. They are also useful for capacity planning, and for spotting sessions that are never terminated.

The **sessions_GGSN** metric labels are optional and depend on the value of the **metrics.network_session_labels** configuration option. If the value of the **sessions.backend** configuration option is set to `mnesia`, the metric does not have any labels. For more information, see the [TPOSS ServiceMonitor and metrics configuration](https://docs.cennso.com/components/tposs/latest/technical-reference/configuration.md#tposs-servicemonitor-and-metrics-configuration) document.

Using the TPOSS chart, you can enable the [PrometheusRule CR](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/developer/alerting.md#deploying-prometheus-rules) that provides two additional metrics:

- `sessions_network_total` - provides the total number of network sessions (see the **sessions_GGSN** metric).
- `sessions_service_total` - provides the total number of service sessions (see the **sessions_scg** metric).

Read the [Prometheus recording rules configuration](https://docs.cennso.com/components/tposs/latest/technical-reference/configuration.md#prometheus-recording-rules) to learn more.

If TPOSS is configured for the legacy setup only with RADIUS communication (`diameter.enabled = false` and `session.backend = mnesia`), the following metrics represent the number of sessions with the given `Access-Class`:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| sessions_portal | counter | | Total number of sessions with Portal Access-Class |
| sessions_online | counter | | Total number of sessions with Online Access-Class |
| sessions_known | counter | | Total number of sessions with Known Access-Class |
