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
.