> 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/runtime.md).

# Runtime metrics

> [!TIP]
> The [Mnesia](#mnesia-metrics) metrics report `0` unless **sessions.backend** is set to `mnesia`.
>
> 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.

This document provides information about the runtime and Mnesia-related metrics exposed by TPOSS.

Look at these metrics when TPOSS uses more memory than expected, or when the instances can no longer communicate with each other.

## OTP runtime metrics

TPOSS exposes the following OTP runtime metrics:

| Metric | Type | Labels | Description |
| ---|---|---|---|
| runtime_otp_release | gauge | | Major version of the Erlang/OTP release |
| runtime_uptime | gauge | | TPOSS uptime in milliseconds |
| runtime_start_time | gauge | | TPOSS startup time in milliseconds since the Unix epoch |
| 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 | gauge | 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

> [!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.

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).

## Mnesia metrics

TPOSS exposes the following Mnesia metrics:

| Metric | Type | Description |
|---|---|---|
| mnesia_tx_commits | gauge | Number that indicates how many transactions have terminated successfully since Mnesia was started |
| mnesia_tx_failures | gauge | Number that indicates how many transactions have failed since Mnesia was started |
| mnesia_tx_restarts | gauge | Number that indicates how many transactions have been restarted since Mnesia was started |
| mnesia_tx_log_writes | gauge | Number that indicates how many write operations have been performed to the transaction log since start-up |
