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

# Metrics

UPG exposes metrics on the `/metrics` endpoint on port `9482`.

UPG exposes all metrics that are present in FPP Manager, and extends it with the following UPG-specific metrics:

| Name | Type | Description |
|:---|:---|:---|
| vpp_nat_pool_block_size | GAUGE | Port block size of the NAT Pool, labeled with pool name and network instance name. Example: `vpp_nat_pool_block_size{name="testing",network_instance="sgi"} 512`
| vpp_nat_pool_capacity | GAUGE | Total capacity of NAT bindings per pool, meaning the maximum number of NAT bindings allocated for UEs. It is calculated as: `External_IPs * (MAX_PORT - MIN_PORT) / BLOCK_SIZE`. Example: `vpp_nat_pool_capacity{name="testing",network_instance="sgi"} 4305`
| vpp_nat_flow_count | GAUGE | Total number of Basic NAT flows. Example: `vpp_nat_flow_count 378`
| vpp_max_nat_flows | GAUGE | Maximum number of Basic NAT flows. Example: `vpp_max_nat_flows 10000000`
| vpp_nat_pool_info | GAUGE | Name of the CG-NAT Pool and Network Instance. Example: `vpp_nat_pool_info{name="testing",network_instance="sgi"} 1`
| vpp_nat_pool_utilization | GAUGE | Number of NAT bindings currently allocated to UEs. Example: `vpp_nat_pool_utilization{name="testing",network_instance="sgi"} 123`
| vpp_nat_pool_flow_count | GAUGE | Total number of CG-NAT flows created per NAT pool. Example: `vpp_nat_pool_flow_count{name="testing",type="tcpudp",thread="0"} 123`
| vpp_upf_flow_count | GAUGE | Total number of flows in UPF. Example: `vpp_upf_flow_count{thread="1"} 123`
| vpp_nat_pool_bytes_total | COUNTER | Number of bytes transferred via CG-NAT Pools. Example: `vpp_nat_pool_bytes_total{name="testing",direction="i2o",thread="0"} 123`
| vpp_nat_pool_packets_total | COUNTER | Number of packets transferred via CG-NAT Pools. Example: `vpp_nat_pool_packets_total{name="testing",direction="i2o",thread="0"} 123`
| vpp_nat_errors_total | COUNTER | Number of packets dropped due to different reasons in CG-NAT. Example: `vpp_nat_errors_total{node="upf-ip4-nat-forward", error="icmp_out_of_ports"} 123`
| vpp_upf_forwarding_policy_info | GAUGE | List of Forwarding Policies configured on UPG instance, with configuration parameters. The `ipv4TableName` and `ipv6TableName` labels carry the names of the `RoutingTable` resources of the policy. `-1` and `none` mean not configured. Value `1` means the Policy is active, `0` lists removed Policies. Example: `vpp_upf_forwarding_policy_info{ipv4TableID="200",ipv4TableName="internet-v4",ipv6TableID="-1",ipv6TableName="none",name="test1",natPools="none"} 1`
| vpp_upf_mss_mismatch | COUNTER | Number of flows in UPF that cannot be stitched from proxy due to the MSS mismatch. Example: `vpp_upf_mss_mismatch 212`
| vpp_upf_tcp_ops_tstamp | COUNTER | Number of flows in UPF that cannot be stitched from proxy due to the mismatch of the TCP Timestamp option. Example: `vpp_upf_tcp_ops_tstamp 512`
| vpp_upf_tcp_sack_permit | COUNTER | Number of flows in UPF that cannot be stitched from proxy due to the TCP SACK-Permitted option. Example: `vpp_upf_tcp_sack_permit 0`
| vpp_upf_total_associations | GAUGE | Total number of UPF associations. Example: `vpp_upf_total_associations 123`
| vpp_upf_total_sessions | GAUGE | Total number of UPF sessions. Example: `vpp_upf_total_sessions{thread="1"} 123`
| vpp_upf_total_stitched | COUNTER | Total number of flows in UPF stitched from proxy. Example: `vpp_upf_total_stitched 8989`
| vpp_upf_ipfix_records_sent_total | COUNTER | Number of IPFIX records sent from the UPF plugin. Example: `vpp_upf_ipfix_records_sent_total 100`
| vpp_upf_ipfix_messages_sent_total | COUNTER | Number of IPFIX messages with reports sent from the UPF plugin. Example: `vpp_upf_ipfix_messages_sent_total 100`
| vpp_pfcp_packets_total | COUNTER | Number of Control Plane messages processed. Contains the `direction`, `type`, and `status` labels. For information about the possible values, read the [section below](#pfcp-metric-labels). Example: `vpp_pfcp_packets_total{direction="tx",status="ok",type="session_deletion_response"} 123`
| vpp_upf_session_reports_total | COUNTER | Number of generated session reports. Example: `vpp_upf_session_reports_total 123`
| vpp_upf_unsolicited_dropped_packets_total | COUNTER | Number of packets dropped due to the ongoing authorization of unsolicited traffic. Example: `vpp_upf_unsolicited_dropped_packets_total{reason="unauthorized"} 100`
| vpp_upf_unsolicited_authorization_requests_total | COUNTER | Number of the requested authorizations of unsolicited traffic. Example: `vpp_upf_unsolicited_authorization_requests_total 10`
| vpp_upf_gtpu_bytes | COUNTER | Number of bytes transferred over the GTP-U endpoint. This number includes the GTP header. Example: `vpp_upf_gtpu_bytes{nwi="epc",direction="rx",ip="172.20.0.1",thread="1"} 123`
| vpp_upf_gtpu_packets | COUNTER | Number of packets transferred over the GTP-U endpoint. Example: `vpp_upf_gtpu_packets{nwi="epc",direction="rx",ip="172.20.0.1",thread="1"} 123`
| vpp_upf_forwarded_packets_total | COUNTER | Number of packets forwarded by direction, protocol, and IP version. Example: `vpp_upf_forwarded_packets_total{direction="download",ip="ip4",protocol="udp"} 123`
| vpp_upf_forwarded_packet_size_bytes | HISTOGRAM | Number of packets forwarded, with each bucket representing the packet size. Example: `vpp_upf_forwarded_packet_size_bytes_bucket{direction="download",ip="ip4",le="64"} 123`
| vpp_upf_sessions_per_gtpu | GAUGE | Number of UPF sessions on the GTP-U endpoint. Example: `vpp_upf_sessions_per_gtpu{name="epc",ip="172.20.0.1"} 123`
| vpp_upf_sessions_per_nwi | GAUGE | Number of UPF sessions on NWI. Example: `vpp_upf_sessions_per_nwi{name="epc"} 123`
| vpp_upf_pool_occupancy_items | GAUGE | Number of items occupying this pool. Example: `vpp_upf_pool_occupancy_items{name="nat_icmp_flows",thread="0"} 123`
| vpp_upf_pool_capacity_items | GAUGE | Number of items fitting in the memory allocated for this pool. Example: `vpp_upf_pool_capacity_items{name="nat_icmp_flows",thread="0"} 123`
| vpp_upf_timers_scheduled | GAUGE | Current number of scheduled internal timers. Example: `vpp_upf_timers_scheduled{thread="1"} 123`
| vpp_upf_timers_started_total | COUNTER | Number of internal timers started. Example: `vpp_upf_timers_started_total{thread="1"} 123`
| vpp_upf_timers_stopped_total | COUNTER | Number of internal timers stopped. Example: `vpp_upf_timers_stopped_total{thread="1"} 123`
| vpp_upf_timers_expirations_total | COUNTER | Number of internal timers expirations. Example: `vpp_upf_timers_expirations_total{thread="1"} 123`
| vpp_upf_timers_lag_seconds | HISTOGRAM | Number of internal timers expirations, with each bucket representing how late in seconds the timer was. Example: `vpp_upf_timers_lag_seconds_bucket{le="0.025"} 123`

## Labels

All UPG metrics (FPP and UPG-specific) have the following list of labels attached:

- `apn="{APN}"` - APN name added with a `UPGDeployment`
- `cnf="upg"` - label for all UPG metrics
- `endpoint="prom-metrics"` - label for all UPG metrics
- `instance="{IP}:9482"` - `{IP}` is a Kubernetes IP of the UPG pod
- `job="{upg_deploy}"` - the name of the UPG deployment
- `namespace="{upg_ns}"` - the name of the namespace where the UPG pod is deployed
- `nf_instance="{upg_instance}"` - the name of the UPG instance pod, which depends on the `UPGDeployment` configuration
- `pod="{upg_pod}"` - the name of the UPG pod
- `release="{upg_name}"` - the name of the `UPGDeployment` of UPG
- `service="{upg_deploy}"` - the name of the UPG deployment

Pool-related metrics have a label `name` that denotes the pool this metric is tracking.
Those metrics are tracked in items, instead of bytes, and each pool has its own item size depending on the underlying structure held in the pool.

## PFCP metric labels

The **vpp_pfcp_packets_total** metric contains the `type`, `status`, and `direction` labels. Together, they can represent a wide range of packet processing events.

The `type` label may contain one of the following values:
- `association_setup_request`
- `association_setup_response`
- `heartbeat_request`
- `heartbeat_response`
- `session_deletion_request`
- `session_deletion_response`
- `session_establishment_request`
- `session_establishment_response`
- `session_modification_request`
- `session_modification_response`
- `session_report_request`
- `session_report_response`

The `status` and `direction` values combinations are like this:

| Direction | Status | Description |
|:---|:---|:---|
| rx | ok | Packet is received and processed successfully |
| rx | error | Packet is received, but processing resulted in a logical error. Examples: server responding with error, session already removed |
| rx | fail | Packet is received, but processing failed due to a system error. Examples: packet is too short, packet is corrupted, unsupported message type |
| rx | retransmit | Packet is received, but it is not processed because it is a retransmission of the previously sent request |
| tx | ok | Request or response sent successfully |
| tx | retransmit | For a request, the packet was sent again because no response had yet been received from the PFCP peer. For a response, the packet was sent again due to the receival of a retransmitted request. |
| tx | fail | Packet was dropped due to a system error, like UDP socket queue being full |
| tx | drop-ratelimit | Packet was dropped due to reaching the configured PFCP messages rate limit |
| tx | req-timeout | PFCP peer did not respond to the request after all retransmission attempts |

## CG-NAT metric labels

UPG CG-NAT-specific metrics are available with NAT pool statistics. These metrics are identified by the `name` label, which contains the NAT pool name.

- `vpp_nat_pool_info` and `vpp_nat_pool_block_size` show the configured NAT pool interface and block size.
- `vpp_nat_pool_utilization` and `vpp_nat_pool_capacity` show the usage of NAT pool blocks.
- `vpp_nat_pool_bytes_total` and `vpp_nat_pool_packets_total` provide NAT pool traffic statistics, with the `direction` label indicating `i2o` (inbound to outbound) or `o2i` (outbound to inbound) direction.
- `vpp_nat_pool_flow_count` provides the number of flows created, with the `type` label showing whether it's a `tcpudp` or `icmp` flow.

The `vpp_nat_errors_total` metric tracks error events that usually result in packet drops. Typical combinations of node and error values are explained in this table:

| `node` value | Direction | `error` value | Description |
| :--- | :--- | :--- | :--- |
| upf-ip4-forward | `i2o` | `unsupported_ip_proto` | UE originated packet with unsupported IP protocol |
| upf-ip4-forward | `i2o` | `out_of_ports` | UE consumed all available NAT block for connections to a specific IP:Port pair |
| upf-ip4-nat-forward | `i2o` | `unsupported_icmp_type` | UE originated ICMP packet with unsupported ICMP type |
| upf-ip4-nat-forward | `i2o` | `icmp_flows_limit_per_binding` | UE reached the limit of ICMP flows per binding |
| upf-ip4-nat-forward | `i2o` | `icmp_out_of_ports` | UE consumed all available NAT blocks for ICMP messages to a specific IP:Identifier pair |
| upf-ip4-nat-dpo | `o2i` | `unknown_flow` | NAT endpoint received a packet with no flow assigned |
| upf-ip4-nat-dpo | `o2i` | `unknown_icmp_flow` | NAT endpoint received an ICMP packet with no flow assigned |
| upf-ip4-nat-dpo | `o2i` | `unsupported_ip_protocol` | NAT endpoint received an ICMP packet with unsupported ICMP type |
