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

# Metrics

TPOSS exposes a rich set of metrics. You can fetch metrics by sending an HTTP request to access the `{HOST}:{PORT}/metrics/v1/values` HTTP endpoint. The `{HOST}` is configured using the **tposs_http_api.host** configuration option. The `{PORT}` is configured using the **tposs_http_api.port** configuration option.

You can export metrics in two formats:

- JSON
- Prometheus

The metrics format depends on the value of the [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept) header from the received request. The value of the **Accept** header can be either `application/json` to export metrics in the JSON format or `text/plain` to export metrics in the Prometheus format. All the metrics described in this document are presented in the [Prometheus format](https://prometheus.io/docs/concepts/data_model).

To discover a Kubernetes [service](https://kubernetes.io/docs/concepts/services-networking/service/) that you can use to access metrics, configure a [ServiceMonitor](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/developer/getting-started.md#using-servicemonitors) using the following configuration parameters:

```yaml
servicemonitor:
  enabled: false
  interval: '30s'
  scrapeTimeout: '30s'
  labels:
    release: prometheus-operator
  annotations: {}
  targetLabels: []
  namespaceSelector: {}
  selector: {}
```

The following sections describe metrics and their datapoints (or labels, in Prometheus terms). If there is no `datapoint` column or the datapoint value is empty, this means:

- Prometheus metrics: no labels for the given metric
- JSON metrics: only the default datapoint `value` is used

## RADIUS server metrics

TPOSS exposes the following RADIUS server metrics:

| Metric | Type | Labels | Description |
|---|---|---|---|
| radiusServUpTime | counter | server_name,server_ip,server_port | Uptime of a RADIUS server |
| radiusServLastRequestTime | counter | server_name,server_ip,server_port | Timestamp of the last RADIUS request handled by a server |
| radiusServRtt | histogram | le,server_name,server_ip,server_port,nas_ip,nas_id | Time spent to handle the incoming RADIUS requests |
| radiusServTotalAccessRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Request requests |
| radiusServTotalAccessAccepts | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Accept responses |
| radiusServTotalAccessRejects | counter | server_name,server_ip,server_port,nas_ip,nas_id,reason | Total number of RADIUS Access-Reject responses |
| radiusServTotalAccessChallenges | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Challenge requests |
| radiusServTotalAccountingRequests | counter | acct_type,server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Accounting requests |
| radiusServTotalAccountingResponses | counter | acct_type,server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Accounting responses |
| radiusServTotalDupRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of duplicated requests |
| radiusServTotalMalformedAccessRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of malformed requests received by a RADIUS server |
| radiusServTotalBadAuthenticators | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of requests received by a RADIUS server with a secret that is not matched to the one configured for this server |
| radiusServTotalPacketsDropped | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of packets dropped by a RADIUS server |
| radiusServTotalUnknownTypes | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of requests of an unknown type received by a RADIUS serve |

### Common labels for RADIUS server metrics

All RADIUS metrics include common labels. This allows for accumulating metrics data for different conditions, such as the total number of RADIUS Accounting requests for the given RADIUS server, the mean time of RADIUS requests arriving at the given RADIUS server, and so on.

 The following labels are present in the RADIUS metrics:

- `server_name` - the name of a RADIUS server
- `server_port` - the port used by a RADIUS server
- `server_ip` - the IP address a RADIUS server listens for incoming RADIUS requests
- `nas_ip` - the NAS IP address from which TPOSS receives RADIUS requests
- `nas_id` - the NAS identifier from which TPOSS receives RADIUS requests

The format of the `nas_id` label depends on the RADIUS configuration. As described in the [RADIUS settings](https://docs.cennso.com/components/tposs/6.19/configuration/radius.md), each RADIUS server must define a list of sources from where RADIUS requests are accepted. Each source may have an optional definition of a NAS identifier, like `proxy` in the example below:

```yaml
radius:
  auth_source:
    ggsn:
      - proxy:secret@192.0.2.0/28
```

If the NAS identifier is specified in the RADIUS source configuration, it is used as the value of the `nas_id` label. If the NAS identifier is not specified, the value of the `nas_id` label is formed by joining the `handler` string, the IP source address from which the RADIUS request was received, and the `auth` or `acct` string.

For example, the value of the `nas_id` label for the following configuration could be `radiusServAcctUpdateRequests{nas_id="auth_192.0.2.0"}`:

```yaml
radius:
  auth_source:
    ggsn:
      - secret@192.0.2.0/28
```

### Labels for RADIUS histogram metrics

The `le` label of the **radiusServRtt** metric is the time value that shows how many RADIUS requests were handled in that time or less. The label and value are translated into Prometheus histogram buckets and are provided in milliseconds. Since the metric is represented as a [Prometheus histogram](https://prometheus.io/docs/practices/histograms), there are two additional associated metrics:

- `radiusServRtt_sum` - total number of RADIUS requests taken into account by the histogram
- `radiusServRtt_count` - sum of round trip time periods taken into account by the histogram

### Additional labels for RADIUS Accounting metrics

Besides the [common labels](#common-labels-for-radius-server-metrics), the **radiusServTotalAccountingRequests** and **radiusServTotalAccountingResponses** metrics have the additional label - `acct_type`. This label provides information about the type of a RADIUS Accounting request. The possible values of this label are: 

- `start`
- `update`
- `stop`

### Additional labels for RADIUS Access-Reject metrics

In addition to [common labels](#common-labels-for-radius-server-metrics), the **radiusServTotalAccessRejects** metric has the additional label `reason`. Its value represents the reason for the rejected RADIUS Access-Request. The label may have the following values:

- `not_authenticated` - The subscriber is not authenticated by TPOSS.
- `blocked_tariff` - The subscriber has the `blocked` tariff.
- `missed_mandatory_avp` - Missing mandatory AVP in the incoming RADIUS Access-Request.
- `database_issue` - The database query failed with error.
- `database_connection_issue` - The database connection was closed during the execution of a query.
- `database_busy` - TPOSS does not have free database connections in the database connection pool.
- `ip_pool_exhausted` - No more IP addresses in the IP pool.
- `ip_allocation_issue` - Allocation of IP address failed because of database or TPOSS issues.
- `duplicated_network_session` - Network session for the given IMSI already exists at TPOSS.
- `user_stat_update_issue` - TPOSS failed to update user statistics when handling RADIUS Access-Request.
- `lock_error` - TPOSS failed to acquire a lock to handle incoming RADIUS requests.
- `ccs_error` - Charging handler failed to handle RADIUS Access-Request from TDF.
- `internal_error` - TPOSS handler crashed when handling the incoming RADIUS Access-Request.
- `unknown` - TPOSS rejected the RADIUS Access-Request by unknown reason.

## RADIUS client metrics

TPOSS exposes the following RADIUS client metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| radiusClientTotalCoARequests | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA requests sent by TPOSS |
| radiusClientTotalCoAAckResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA-ACK responses received by TPOSS |
| radiusClientTotalCoANakResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA-NAK responses received by TPOSS |
| radiusClientTotalDisconnectRequests | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect requests sent by TPOSS |
| radiusClientTotalDisconnectAckResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect-ACK responses received by TPOSS |
| radiusClientTotalDisconnectNakResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect-NAK responses received by TPOSS |

Each RADIUS client metric contains the following labels:

- `client_ip` - the IP address used by TPOSS RADIUS client to send RADIUS requests
- `client_name` - the name of RADIUS client used by TPOSS to send RADIUS requests
- `server_name` - the RADIUS server name where TPOSS sends RADIUS requests
- `server_ip` - the RADIUS server IP address where TPOSS sends RADIUS requests
- `server_port` - the RADIUS server port where TPOSS sends RADIUS requests

## Diameter metrics

TPOSS exposes the following Diameter metrics:

| Metric | Type | Labels | Description |
|---|---|---|---|
| diameter_requests_gx_total | counter | type | Total number of Gx requests received by TPOSS |
| diameter_requests_gy_total | counter | type | Total number of Gy requests received by TPOSS |
| diameter_requests_gx_retransmits | counter | | Total number of Gx retransmissions |
| diameter_requests_gy_retransmits | counter | | Total number of Gy retransmissions |
| diameter_requests_gx_errors_total | counter | code | Total number of Gx errors |
| diameter_requests_gy_errors_total | counter | code | Total number of Gy errors |
| diameter_requests_rar_total | counter | | Total number of RAR requests sent by TPOSS |
| diameter_rar_errors_total | counter | | Total number of failed RAR requests sent by TPOSS |
| diameter_requests_asr_total | counter | | Total number of ASR requests sent by TPOSS |
| diameter_asr_errors_total | counter | | Total number of failed ASR requests sent by TPOSS |
| diameter_requests_nasreq_total | counter | type | Total number of NASREQ requests received by TPOSS |
| diameter_nasreq_errors_total | counter | code | Total number of NASREQ errors |
| diameter_requests_rtt_milliseconds | histogram | le | Time needed to handle an incoming Diameter request |
| diameter_if_requests_rtt_milliseconds | histogram | le, type | Time needed to handle an incoming Diameter request per Diameter interface |

TPOSS exposes Diameter metrics with different labels. Each metric related to a Diameter response has the `code` label. The `code` label specifies the value of the Diameter `Result-Code` AVP.

For all metrics except **diameter_if_requests_rtt_milliseconds**, the `type` label specifies the type of the Diameter requests for a given protocol. 

### Diameter Gx/Gy request types

The following types exist for the Diameter `Gx` and `Gy` requests:

- `initial` - Diameter Gx and Gy initial requests
- `interim` - Diameter Gx and Gy update requests
- `stop` - Diameter Gx and Gy termination requests

### Diameter NASREQ request types

The following types exist for the Diameter NASREQ requests:

- `aar` - Diameter NASREQ Authorization and Authentication requests
- `acr_start` - Diameter NASREQ Accounting-Start requests
- `acr_interim` - Diameter NASREQ Accounting-Interim-Update requests
- `acr_stop` - Diameter NASREQ Accounting-Stop
- `str`- Diameter NASREQ Session-Termination requests

### Extended Diameter request type

For the **diameter_if_requests_rtt_milliseconds** metric, the `type` label specifies the type of Diameter request per interface. The label may have the following values:

- `gx_initial` - Diameter Gx initial requests
- `gx_update` - Diameter Gx interim requests
- `gx_terminate` - Diameter Gx terminate requests
- `gy_initial` - Diameter Gy initial requests
- `gy_update` - Diameter Gy interim requests
- `gy_terminate` - Diameter Gy terminate requests
- `aar` - Diameter NASREQ AAR requests
- `acr_start` - Diameter NASREQ Accounting-Start requests
- `acr_interim` - Diameter NASREQ Accounting-Interim-Update requests
- `acr_stop` - Diameter NASREQ Accounting-Interim-Stop requests
- `acr_event` - Diameter NASREQ Accounting-Event requests
- `str` - Diameter NASREQ STR requests

### Diameter histogram metric labels

The `le` label of the **diameter_requests_rtt_milliseconds** is the time value that shows how many Diameter requests were handled in that time or less. The label and value are translated into Prometheus histogram buckets and are provided in milliseconds. Since the metric is represented as a [Prometheus histogram](https://prometheus.io/docs/practices/histograms), there are two additional associated metrics:

- **diameter_requests_rtt_milliseconds_count** - total number of Diameter requests taken into account by the histogram
- **diameter_requests_rtt_milliseconds_sum** - sum of round trip time periods taken into account by the histogram

## API metrics

TPOSS exposes the following API-related metrics:

| Metric | Type | Label | Description |
| ---|---|---|---|
| api_requests_rtt | histogram | api, le | Latency distribution (in milliseconds) for handling API requests |
| api_requests_total | counter | api | Total number of API requests received by TPOSS |
| api_requests_success | counter | api | Total number of successfully handled API requests |
| api_requests_error | counter | api, code | Total number of failed API requests |

The `le` label of the **api_requests_rtt** metric is the time value that shows how many API requests were handled in that time or less. The label and value are translated into Prometheus histogram buckets and are provided in milliseconds. Since the metric is represented as a [Prometheus histogram](https://prometheus.io/docs/practices/histograms), there are two additional associated metrics:

- **api_requests_rtt_count** - total number of observations taken into account by the histogram
- **api_requests_rtt_sum** - sum of time periods that TPOSS spent to handle API requests

The `code` label of the **api_request_error** metric is the [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status) returned by the TPOSS API handlers.

The `api` label identifies the type of TPOSS API. The metrics listed above are collected for the following API types:

- [HTTP REST API](https://docs.cennso.com/components/tposs/6.19/api-reference/rest/api.md)
- [CDMP API](https://docs.cennso.com/components/tposs/6.19/architecture/cdmp.md)
- [SBI API](https://docs.cennso.com/components/tposs/6.19/architecture/sbi.md)

For SBI and CDMP, the `api` label may have the following values that show the number of requests, responses, and the latency of the given type of API:

- `nnas_auth_create`
- `nnas_auth_update`
- `nnas_auth_release`
- `nnas_acct_create`
- `nnas_acct_update`
- `nnas_acct_release`
- `npcf_create`
- `npcf_update`
- `npcf_release`
- `nchf_create`
- `nchf_update`
- `nchf_release`

For the TPOSS HTTP REST API, the `api` label consists of the API name and action split by an underscore. The following API actions are used:

- `create`
- `update`
- `upgrade`
- `read`
- `bulk_read`
- `fetch`
- `import`
- `delete`
- `delete_old`
- `list`
- `combined_list`
- `stop`

For example - `subscriber_create`, `account_delete`, `balance_upgrade`, `cdr_bulk_read`, and so on.

### External API

In addition to the API handlers that TPOSS provides, TPOSS also uses external API and exposes the following metrics triggered when TPOSS executes external API calls:

| Metric | Type | Label | Description |
| ---|---|---|---|
| npcf_rar_requests_total | counter | | Total number of SBI Npcf reauthorization requests |
| npcf_rar_request_errors_total | counter | reason | Total number of SBI Npcf reauthorization errors |
| nchf_rar_requests_total | counter | | Total number of SBI Nchf reauthorization requests |
| nchf_rar_request_errors_total | counter | reason | Total number of SBI Nchf reauthorization errors |
| nchf_asr_requests_total | counter | | Total number of SBI Nchf abort session requests |
| nchf_asr_request_errors_total | counter | reason | Total number of SBI Nchf abort session errors |

The `reason` label of the error metrics represents the reason why the outgoing request failed. The `reason` can be an [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status) or one of the next values:

- `cant_send_request` - TPOSS should send an outgoing request, but can not do it because of not enough data for the given session.
- `client_failure` - A client used by TPOSS failed to send a request due to overload or another reason, or sent a request but did not get a response.
- `pool_error` - TPOSS should send an outgoing request, but can not do it because no connections are available.

## PCS sessions metrics

TPOSS exposes the following PCS sessions metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| sessions_GGSN | gauge | visitedNetworkMCC, visitedNetworkMNC, activeProfile | Total number of network sessions |
| sessions_RUCKUS | gauge | | Total number of RUCKUS 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 3GGP-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`) |

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/6.19/installation/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/6.19/installation/configuration.md#prometheus-recording-rules) to learn more.

> [!NOTE]
> The **rating_group_total** counters are only available when `diameter.enabled = true` and `session.backend = mysql` are set.

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 | Labels | Type | 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 |

## Database metrics

TPOSS exposes the following database metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| db_requests_total | counter | | Total number of queries to the database |
| db_requests_ok | counter | | Total number of successful queries to the database |
| db_requests_error | counter | | Total number of failed queries to the database |
| db_requests_rtt | histogram | le | Duration of calls to the database |
| db_requests_query_rtt | histogram | le | Duration of database queries |
| db_requests_queue_rtt | histogram | le | Duration of query queue time |
| db_requests_decode_rtt | histogram | le | Duration of time decoding the result of a query |
| db_requests_idle_rtt | histogram | le | Number of times the connection was idle before use |
| db_pool_free_connections | gauge | | Number of free connections in a database pool |
| db_pool_queue_length | gauge | | Number of queries waiting in a database pool queue for a free database connection |
| db_connections_total | gauge | | Number of database connections configured in TPOSS |
| db_connections_connected_total | gauge | | Number of database connections successfully connected to a database |
| db_health_status | gauge | component | Database health status |
| tposs_cdr_db_handler_errors | counter | | Number of failures of TPOSS CDR database controller |
| accounts_activated | counter | | Total number of activated accounts |
| accounts_total | counter | | Total number of accounts |
| balances_total | counter | | Total number of balances |
| cdrs_total | counter | | Total number of closed CDRs |
| sessions_total | counter | | Total number of charging sessions |
| carriers_total | counter | | Total number of carriers |
| carrier_groups_total | counter | | Total number of carrier groups |
| services_total | counter | | Total number of services |
| tariffs_total | counter | | Total number of tariffs |
| service_profiles_total | counter | | Total number of service profiles |
| public_users_total | counter | | Total number of public users |
| private_user_total | counter | | Total number of private users |
| credentials_total | counter | | Total number of credentials |
| subscribers_total | counter | | Total number of subscribers |
| whitelist_imeis | counter | | Number of IMEIs in the whitelist |

The `le` label in the histogram metrics represents an upper time bound for a [Prometheus bucket](https://prometheus.io/docs/practices/histograms). Each bucket shows the number of operations that were completed in less than or equal to the specified time (in milliseconds). For example, if the metric **db_requests_query_rtt** has label `le=5` and a value of `100`, it indicates that `100` database queries were completed within 5 milliseconds or less.

The **db_health_status** metric provides the `component` value, which represents the status of the database health check procedure. The label may have the following values:

- `ping` - Result of the MySQL protocol-level ping sent directly to the database host.
- `queue` - Specifies whether the database connection pool queue length is below the configured maximum.

The value of the metric is `1` if the check was successful, or `0` if not.

For more information, see the [Database health check](https://docs.cennso.com/components/tposs/6.19/configuration/db.md#database-health-check) section.

## IP pools metrics

TPOSS exposes the following IP pools metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| ip_pool_block_used_ips_total | gauge | instance, block, pool_name, pool_range | Number of used IPs within the block |
| ip_pool_block_used_ips_pct | gauge | instance, block, pool_name, pool_range | Percentage of used IPs within the block |
| ip_pool_block_total | counter | instance, block, pool_name, pool_range | Total number of IPs within the block |
| ip_pool_total | gauge | pool_name, pool_range | Total number of IPs within the pool |

The metrics **ip_pool_block_used_ips_pct**, **ip_pool_block_used_ips_total**, and **ip_pool_block_total** provide the following labels:

- `instance` – Name of the TPOSS node that manages the given IP block.
- `block` – The IP block that is managed.
- `pool_name` – Name of the IP pool from which the IP block is allocated.
- `pool_range` – IP range from which the IP block is allocated.

> [!NOTE]
> You can not use the **ip_pool_block_total** metric to get the total number of IPs managed by TPOSS IP pools. This metric returns the number of IP addresses only within the reserved IP blocks but not in all of them.

## Events metrics

TPOSS exposes the following CCS hooks-related metrics:

| Metric | Type | Description |
| ---|---|---|
| hooks_balance_threshold_resend | counter | Number of tries to resend balance threshold notifications |
| hooks_balance_threshold_success | counter | Number of successfully sent balance threshold notifications |
| hooks_balance_threshold_fail | counter | Number of failed tries to send balance threshold notifications |
| hooks_visited_country_change_resend | counter | Number of tries to resend visited country change notifications |
| hooks_visited_country_change_success | counter | Number of successfully sent visited country change notifications |
| hooks_visited_country_change_fail | counter | Number of failed tries to send visited country change notifications |
| hooks_mccmnc_change_resend | counter | Number of tries to resend MCC/MNC change notifications |
| hooks_mccmnc_change_success | counter | Number of successfully sent MCC/MNC change notifications |
| hooks_mccmnc_change_fail | counter | Number of failed tries to send MCC/MNC change notifications |
| hooks_charging_rules_change_resend | counter | Number of tries to resend charging rules change notifications |
| hooks_charging_rules_change_success | counter | Number of successfully sent charging rules change notifications |
| hooks_charging_rules_change_fail | counter | Number of failed tries to send charging rules change notifications |
| hooks_network_attachment_first_resend | counter | Number of tries to resend first network attachment notifications |
| hooks_network_attachment_first_success | counter | Number of successfully sent network attachment notifications |
| hooks_network_attachment_first_fail | counter | Number of failed tries to send the first network attachment notifications |

For more information, see the [Hooks configuration](https://docs.cennso.com/components/tposs/6.19/configuration/hooks.md) document.

## OTP runtime metrics

TPOSS exposes the following OTP runtime metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| runtime_otp_release | counter | | Major version of the Erlang/OTP release |
| runtime_uptime | counter | | TPOSS uptime in milliseconds |
| runtime_start_time | counter | | TPOSS startup time |
| runtime_garbage_collection | gauge | datapoint | Erlang VM garbage collector statistics |
| runtime_ram | gauge | datapoint | Information about memory allocated by the Erlang VM |
| runtime_ports | gauge | datapoint | Number and limit of ports currently existing at the node |
| runtime_processes | gauges | datapoint | Information about processes in the Erlang VM |
| runtime_processors | gauge | datapoint | Information about processors in the system |
| runtime_io | gauge | datapoint | Total number of received and transmitted bytes over network |
| cluster_nodes | gauge | | Number of TPOSS instances connected to the instance where the metric is read (including the instance itself) |
| erlang_vm_allocators | gauge | alloc, instance_no, kind, usage | Memory allocated and used by different allocators in the Erlang VM: `carriers_size` represents the total size of large contiguous memory blocks (carriers) allocated by the VM. These carriers are divided into sections, with `blocks_size` indicating the total memory currently in use within those blocks. |

The value of the `datapoint` label depends on the metric.

### Erlang VM garbage collection datapoints

The **runtime_garbage_collection** metric may have the following datapoint values:

- `number_of_gcs` - total number of garbage collections performed by a VM
- `words_reclaimed` - total number of words reclaimed during garbage collections

### Erlang VM I/O datapoints

The **runtime_io** metric may have the following datapoint values:

- `input` - total number of bytes received by a VM
- `output` - total number of bytes sent by a VM

### Erlang VM memory datapoints

The **runtime_ram** metric may have the following datapoint values:

- `total` - total number of bytes currently allocated by the underlying BEAM virtual machine
- `processes` - total number of bytes allocated for the processes
- `processes_used` - total number of bytes currently used by the processes
- `system` - total number of bytes allocated by the underlying BEAM virtual machine for system purposes
- `atom` - total number of bytes allocated by the underlying BEAM virtual machine for atoms
- `atom_used` - total number of bytes currently used for atoms
- `binary` - total number of bytes allocated by the underlying BEAM virtual machine for binaries
- `code` - total number of bytes allocated by the underlying BEAM virtual machine for code
- `ets` - total number of bytes allocated by the underlying BEAM virtual machine for ETS tables

### Erlang VM ports datapoints

The **runtime_ports** metric may have the following datapoint values:

- `port_count` - number of ports currently existing at the TPOSS node
- `port_limit` - maximum number of simultaneously existing ports at the TPOSS node

### Erlang VM processes datapoints

The **runtime_processes** metric may have the following datapoint values:

- `process_count` - number of processes launched by TPOSS
- `process_limit` - maximum number of processes that can be launched by TPOSS
- `run_queue_size` - total length of all normal and dirty CPU run queues

### Erlang VM processors datapoints

The **runtime_processors** metric may have the following datapoint values:

- `logical_processors` - detected number of logical processors configured in the system
- `logical_processors_available` - detected number of logical processors available to the TPOSS runtime system

### Erlang VM allocators datapoints

The **erlang_vm_allocators** metric provides information about different memory allocators in the Erlang VM.

- `alloc` - the memory allocator name. The possible values are: `temp_alloc`, `eheap_alloc`, `binary_alloc`, `ets_alloc`, `driver_alloc`, `literal_alloc`, `sl_alloc`, `ll_alloc`, `fix_alloc`, or `std_alloc`. For more information about different types of memory allocators, read the [Erlang documentation](https://www.erlang.org/doc/apps/erts/erts_alloc.html#allocators).
- `instance_no` - instance number of the memory allocator.
- `kind` - type of the memory allocator. The possible values are: `mbcs` for the multi-block carriers, `sbcs` for the single-block carriers, and `mbcs_pool` for pool of multi-block carriers.
- `usage` - details about the different aspects of memory usage for the given memory allocator.

For more information about the Erlang VM allocators, read the [official documentation](https://www.erlang.org/doc/apps/erts/erts_alloc.html).

> [!NOTE]
> This metric is enabled only in the [Prometheus format](https://prometheus.io/docs/concepts/data_model) and does not appear if you request metrics in the JSON format.

## NATS metrics

TPOSS exposes the following NATS metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| nats_requests_rtt | histogram | service, le | Handle time of NATS requests in milliseconds |

The `le` label of the **nats_requests_rtt** metric is the time value that shows how many NATS requests were handled in that time or less. The label and value are translated into Prometheus histogram buckets and are provided in milliseconds. Since the metric is represented as a [Prometheus histogram](https://prometheus.io/docs/practices/histograms), there are two additional associated metrics:

- `nats_requests_rtt_count` - total number of NATS requests taken into account by the histogram.
- `nats_requests_sum` - sum of round trip time periods taken into account by the histogram.

The `service` label specifies the NATS service name defined by the **nats-services.{SERVICE_NAME}** configuration option.

## Mnesia metrics

TPOSS exposes the following Mnesia metrics:

| Metric | Type | Description |
| ---|---|---|
| runtime_mnesia_tx_commits | gauge | Number that indicates how many transactions have terminated successfully since Mnesia was started |
| runtime_mnesia_tx_failures | gauge | Number that indicates how many transactions have failed since Mnesia was started |
| runtime_mnesia_tx_restarts | gauge | Number that indicates how many transactions have been restarted since Mnesia was started |
| runtime_mnesia_tx_log_writes | gauge | Number that indicates how many write operations have been performed to the transaction log since start-up |

## External memory allocators metrics

The IP pools are built on top of a library that uses [jemalloc](https://jemalloc.net/) memory allocator. TPOSS provides the following metrics to get information about the memory allocated for IP pools:

| Metric | Type | Description |
|---|---|---|
| jemalloc_active | gauge | Total number of bytes in allocated active pages |
| jemalloc_allocated | gauge | Total number of allocated bytes |
| jemalloc_mapped | gauge | Total number of bytes in active extents mapped by the allocator |
| jemalloc_metadata | gauge | Total number of bytes allocated for metadata |
| jemalloc_resident | gauge | Maximum number of bytes in physically resident data pages mapped by the allocator |
| jemalloc_retained | gauge | Total number of bytes in virtual memory mappings that were retained and not returned to the operating system |

## Other metrics

The following metrics do not belong to any other category:

| Metric | Type | Description |
|---|---|---|
| tposs_cdr_file_handler_errors | counter | Number of failures from accessing the filesystem for CDR storage operations. All the I/O and file operation failures are included, such as errors in opening or closing a CDR file, renaming a CDR file, creating a directory for CDRs, and so on.|
