#prometheus (2023-09)

prometheus

Archive: https://archive.sweetops.com/prometheus/

2023-09-01

2023-09-06

Sean avatar

Anyone know how to query Prometheus to determine: • a) What the current cardinality is of a metric? • b) What the cardinality will be with some labels removed? For example, a metric like this (with millions of entries):

mymetric_seconds_sum{
  app="myapp",
  instance="192.168.33.93:8983",
  job="kubernetes-pods",
  kubernetes_namespace="myapp",
  kubernetes_pod_name="myapp-76b58548cb-8sd8h",
  method="CreateMagicEvent",
  pod_template_hash="76b58548cb",
  status="ABORTED"
}

Then that same metric reduced down to only these labels:

app
kubernetes_namespace
method
status

^ thinking a script that parses the group expr: and queries the Prometheus API for the series count.

    keyboard_arrow_up