Skip to main content

Overview

See our Prometheus integration documentation for how to set Prometheus up to automatically discover and scrape metrics for your database branches. If you’re using Datadog, see our Datadog tutorial for how to setup your Datadog agent to scrape metrics for your branch.

Metrics

PlanetScale Postgres emits the following metrics to be scraped.

Database Metrics

Edge Metrics

PgBouncer Metrics

Infrastructure Metrics

Deprecated Metrics

These metrics are deprecated and will be removed eventually.

Attributing Container Restarts

planetscale_pods_container_status_restarts_total counts every restart and carries no role or reason label. Join the metric that carries the one you want. To break restarts down by role, join planetscale_pods_status_phase:
To break restarts down by reason as well, filter against planetscale_pods_container_last_terminated_reason one minute at a time and join the role onto the result:
The gauge only reports a container’s latest termination reason, so the query attributes each minute’s restarts to the reason current in that minute, then sums over the hour. Change 1h to your own window and leave the 1m alone. A container that restarts twice inside one minute under two different reasons has both restarts attributed to the later one.

Tag Glossary

  • cluster: The PlanetScale cluster identifier
  • planetscale_access: The access path on bytes sent/received metrics (public for traffic over the public internet, or private for traffic over AWS PrivateLink or GCP Private Service Connect)
  • planetscale_database_branch_id: The unique identifier for the database branch
  • planetscale_pod: The Kubernetes pod name
  • planetscale_container: The container name (postgres, pgbouncer, walg-daemon)
  • planetscale_role: The database role (primary, replica). Absent on pods that have no role, such as pgbouncer
  • planetscale_cell: The PlanetScale cell identifier
  • planetscale_phase: The pod’s status phase (Running, Pending, Failed, Succeeded, Unknown)
  • planetscale_component: The PlanetScale component identifier
  • planetscale_connection_state: The state of database connections
  • planetscale_lock_mode: The PostgreSQL lock mode
  • planetscale_wait_event_type: The PostgreSQL wait event type of an active backend (for example Lock, LWLock, IO, Client), or CPU when the backend is not waiting
  • planetscale_wait_event: The PostgreSQL wait event of an active backend (for example transactionid, DataFileRead, ClientRead), or CPU when the backend is not waiting
  • planetscale_database_name: The PostgreSQL database name
  • planetscale_port: The connection port number
  • planetscale_region: The geographic region
  • planetscale_pgbouncer_pool: The PgBouncer connection pool identifier
  • planetscale_connector_id: The edge connector identifier
  • planetscale_restart_reason: Reason for a container’s most recent termination (OOMKilled, Error, Completed). Carried by planetscale_pods_container_last_terminated_reason

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.