> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/upg/2.17/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/2.17/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 123`
| vpp_nat_pool_bytes_total | COUNTER | Number of bytes transferred via CG-NAT Pools. Example: `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: `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_mss_mismatch | COUNTER | Number of flows in UPF that can not be stitched from proxy due to the MSS mismatch. Example: `vpp_upf_mss_mismatch 212`
| vpp_upf_stitched_dirty_fifos | COUNTER | Number of flows in UPF that stitched but transport connection is not yet flushed. Example:  `vpp_upf_stitched_dirty_fifos 3890`
| vpp_upf_tcp_ops_tstamp | COUNTER | Number of flows in UPF that can not 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 can not be stitched from proxy due 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 123`
| vpp_upf_total_stitched | COUNTER | Total number of flows in UPF stitched from proxy. Example: `vpp_upf_total_stitched 8989`
| vpp_upf_timers_missed | COUNTER | Number of timers missed for more than 5 seconds. Example: `vpp_upf_timers_missed 0`
| 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_received_incorrect | COUNTER | Number of messages from the Control Plane that were not decoded properly. May include messages other than PFCP. Example: `vpp_pfcp_received_incorrect 0`
| vpp_pfcp_messages_processed_total | COUNTER | Number of PFCP messages processed and responded to. Contains the `type` label denoting the message type and `direction`. Example: `vpp_pfcp_messages_processed_total{type="session_establishment",direction="rx"} 123`
| vpp_pfcp_errors_total | COUNTER | Number of PFCP messages processed and responded with an error status. Contains the `type` label denoting the message type and `direction`. Example: `vpp_pfcp_errors_total{type="session_establishment",direction="rx"} 0`
| 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 authorisation of unsolicited traffic. Example: `upf_unsolicited_dropped_packets_total{reason="unauthorized"} 100`
| vpp_upf_unsolicited_authorization_requests_total | COUNTER | Number of the requested authorisations of unsolicited traffic. Example: `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"} 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"} 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`

## Labels

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

- `apn="{APN}"` - APN name added with a Helm deployment
- `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 Helm chart deployment configuration
- `pod="{upg_pod}"` - the name of the UPG pod
- `release="{upg_name}"` - the name of the Helm chart deployment 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 Message types

The `type` label exists on `vpp_pfcp_messages_processed_total` and `vpp_pfcp_errors_total` metrics. It may contain one of the following values:
- `heatbeat`
- `pfd_management`
- `association_setup`
- `association_update`
- `association_release`
- `node_report`
- `session_set_deletion`
- `session_establishment`
- `session_modification`
- `session_deletion`
- `session_report`

The `direction` label also exists on those metrics and may be `rx` or `tx`
