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

# Metrics

TPOSS exposes a rich set of metrics that you can use to monitor the state of TPOSS deployments. 

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. For example:

```yaml
tposs_http_api:
  host: 0.0.0.0
  port: 8080
```

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 one of: 

- `application/json` - to export metrics in the JSON format
- `text/plain` - to export metrics in the Prometheus format

All the metrics described in these documents 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 metrics are described in the following documents:

- [RADIUS metrics](https://docs.cennso.com/components/tposs/latest/observability/radius.md)
- [Diameter metrics](https://docs.cennso.com/components/tposs/latest/observability/diameter.md)
- [HSS metrics](https://docs.cennso.com/components/tposs/latest/observability/hss.md)
- [API metrics](https://docs.cennso.com/components/tposs/latest/observability/api.md)
- [PCS sessions metrics](https://docs.cennso.com/components/tposs/latest/observability/session.md)
- [Database and storage metrics](https://docs.cennso.com/components/tposs/latest/observability/db.md)
- [IP pools metrics](https://docs.cennso.com/components/tposs/latest/observability/ip-pools.md)
- [Events metrics](https://docs.cennso.com/components/tposs/latest/observability/events.md)
- [Runtime metrics](https://docs.cennso.com/components/tposs/latest/observability/runtime.md)
- [NATS metrics](https://docs.cennso.com/components/tposs/latest/observability/nats.md)

## Histogram metrics

Every metric of the `histogram` type exposed by TPOSS is a [Prometheus histogram](https://prometheus.io/docs/practices/histograms), and the rules below apply to all of them.

The `le` label of every histogram is an upper time bound in milliseconds. The value of a bucket is the number of observations that completed within that time or less specified by the bucket name. For example, if **db_requests_query_rtt** has the label `le=5` and the value `100`, then `100` database queries completed within 5 milliseconds or less.

Each histogram also exposes two additional metrics named after it:

- `{METRIC}_count` - the number of observations taken into account by the histogram
- `{METRIC}_sum` - the sum of all the observed values

For example, for the **db_requests_query_rtt** metric, these additional metrics are **db_requests_query_rtt_count** and **db_requests_query_rtt_sum**.
