--- title: "Built-in Metrics" description: "Complete reference of all metrics collected for your Miget apps." --- Miget automatically collects metrics for every app and addon in your workspace. All metrics use the `miget_` prefix and are available in Grafana dashboards and the Metrics API. ## App Metrics Metrics about your application's deployment status and HTTP traffic. ### Replicas | Metric | Type | Description | |--------|------|-------------| | `miget_app_replicas_desired` | Gauge | Number of replicas configured for the app | | `miget_app_replicas_available` | Gauge | Number of replicas currently running and ready | **Labels:** `namespace`, `app` ### HTTP | Metric | Type | Description | |--------|------|-------------| | `miget_app_http_responses_total` | Counter | Total HTTP responses, broken down by status code | | `miget_app_http_response_time_seconds_bucket` | Histogram | HTTP response time distribution | | `miget_app_http_response_time_seconds_count` | Histogram | Total number of HTTP requests | | `miget_app_http_response_time_seconds_sum` | Histogram | Total HTTP response time | **Labels:** `namespace`, `app`, `status`, `method` Use `histogram_quantile()` to calculate percentiles from the histogram: ```promql histogram_quantile(0.99, sum(rate(miget_app_http_response_time_seconds_bucket{app="my-app"}[5m])) by (le)) ``` ## Instance Metrics Metrics about individual app instances (pods). Each running instance of your app reports these independently. ### CPU & Memory | Metric | Type | Unit | Description | |--------|------|------|-------------| | `miget_instance_cpu_usage` | Gauge | Cores | Current CPU usage | | `miget_instance_memory_used_bytes` | Gauge | Bytes | Current memory usage | | `miget_instance_resource_limit` | Gauge | Varies | Resource limit (CPU in cores, memory in bytes) | | `miget_instance_resource_request` | Gauge | Varies | Resource request (CPU in cores, memory in bytes) | **Labels:** `namespace`, `instance`, `app`, `resource` (for limits/requests: `cpu` or `memory`) ### Network | Metric | Type | Unit | Description | |--------|------|------|-------------| | `miget_instance_net_recv_bytes_total` | Counter | Bytes | Total bytes received | | `miget_instance_net_sent_bytes_total` | Counter | Bytes | Total bytes sent | | `miget_instance_net_recv_packets_total` | Counter | Packets | Total packets received | | `miget_instance_net_sent_packets_total` | Counter | Packets | Total packets sent | **Labels:** `namespace`, `instance`, `app` ### Disk | Metric | Type | Unit | Description | |--------|------|------|-------------| | `miget_instance_disk_read_bytes_total` | Counter | Bytes | Total bytes read from disk | | `miget_instance_disk_write_bytes_total` | Counter | Bytes | Total bytes written to disk | | `miget_instance_disk_read_ops_total` | Counter | Operations | Total disk read operations | | `miget_instance_disk_write_ops_total` | Counter | Operations | Total disk write operations | | `miget_instance_disk_read_latency_microseconds` | Gauge | Microseconds | Average disk read latency | | `miget_instance_disk_write_latency_microseconds` | Gauge | Microseconds | Average disk write latency | **Labels:** `namespace`, `instance`, `app`, `device` ### Status | Metric | Type | Description | |--------|------|-------------| | `miget_instance_status_phase` | Gauge | Pod phase (1 = active for that phase) | | `miget_instance_restarts_total` | Counter | Total container restarts | | `miget_instance_oom_events_total` | Counter | Total out-of-memory kills | | `miget_instance_start_time` | Gauge | Instance start timestamp (Unix seconds) | **Labels:** `namespace`, `instance`, `app`, `phase` (for status_phase: `Pending`, `Running`, `Succeeded`, `Failed`) ## Volume Metrics Metrics about persistent storage attached to your apps. | Metric | Type | Unit | Description | |--------|------|------|-------------| | `miget_volume_used_bytes` | Gauge | Bytes | Used space on the volume | | `miget_volume_size_bytes` | Gauge | Bytes | Total volume capacity | | `miget_volume_iops_limit` | Gauge | IOPS | Volume IOPS rate limit | | `miget_volume_bw_limit_bytes` | Gauge | Bytes/sec | Volume bandwidth rate limit | **Labels:** `namespace`, `app`, `addon`, `addon_type`, `volume` (the two limit metrics also carry `device`) `miget_volume_used_bytes` and `miget_volume_size_bytes` are read from the filesystem on the volume, so used space includes everything stored there. For a managed PostgreSQL instance that means tables, indexes, WAL and temporary files. Space left for writes is `miget_volume_size_bytes - miget_volume_used_bytes`. Both are collected every 30 seconds from a reading that refreshes once a minute. `volume` is the volume's name. For managed PostgreSQL it is `-`, and an instance that is rebuilt gets a new number, so select on `addon` (the service name) rather than on `volume` when you build alerts. ## Addon Metrics ### PostgreSQL | Metric | Type | Unit | Description | |--------|------|------|-------------| | `miget_addon_pg_connections` | Gauge | Connections | Active database connections | | `miget_addon_pg_database_size_bytes` | Gauge | Bytes | Database size | | `miget_addon_pg_replication_lag_seconds` | Gauge | Seconds | Replication lag to standby | | `miget_addon_pg_up` | Gauge | Boolean | Database health (1 = up) | | `miget_addon_pg_commits_total` | Counter | Transactions | Committed transactions | | `miget_addon_pg_rollbacks_total` | Counter | Transactions | Rolled back transactions | | `miget_addon_pg_deadlocks_total` | Counter | Deadlocks | Deadlocks detected | | `miget_addon_pg_blocks_hit_total` | Counter | Blocks | Blocks served from cache | | `miget_addon_pg_blocks_read_total` | Counter | Blocks | Blocks read from disk | **Labels:** `namespace`, `addon`, `addon_type`, `instance`, `database`, `role` Cache hit ratio is derived rather than reported: `blocks_hit / (blocks_hit + blocks_read)`. It is undefined until something has been read - a database that has served nothing is not a cache missing every time. Per-database metrics cover the system databases too. Filter with `database!~"postgres|template.*"` to count only the databases you created; on a small instance the system ones are a large share of the total size. ### Valkey and MySQL **No engine-level metrics.** PostgreSQL is instrumented because CloudNativePG runs an exporter inside every instance pod. Valkey and MySQL pods are single-container with nothing to scrape, so there is no equivalent of the table above and none is planned. They are not unmonitored: CPU, memory, restarts, network, disk and volume usage are collected for every addon regardless of engine, from the [instance](#instance-metrics) and [volume](#volume-metrics) metrics. ## Common Labels Every metric includes these labels: | Label | Description | |-------|-------------| | `namespace` | Your workspace's Kubernetes namespace | | `app` | App name (for app metrics) | | `addon` | Addon name (for addon metrics) | | `addon_type` | Addon type, e.g. `postgres` (for addon metrics) | | `instance` | Individual instance (pod) name |