Agent skill

Prometheus Cardinality Optimizer

by prometheus in prometheus/prometheus-mcp

Finds the metrics and labels behind a Prometheus series explosion using a connected Prometheus MCP server, then proposes relabeling, dropping or recording-rule fixes with measured impact.

Apache-2.0Auto-check passedDevOps & Cloud

Install Prometheus Cardinality Optimizer

skills CLI
$ npx skills add prometheus/prometheus-mcp --skill optimize-high-cardinality -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install prometheus/prometheus-mcp optimize-high-cardinality --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/prometheus/prometheus-mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/pkg/mcp/assets/skills/optimize-high-cardinality .claude/skills/optimize-high-cardinality && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
optimize-high-cardinality
GitHub stars
117
Token cost
~547 tokens
SKILL.md length
232 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
Apache-2.0

At a glance

Finds the metrics and labels behind a Prometheus series explosion using a connected Prometheus MCP server, then proposes relabeling, dropping or recording-rule fixes with measured impact.

  • Series counts or Prometheus memory use keep growing
  • SKILL.md covers Getting oriented, Topics worth exploring and Suggesting changes
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Queries have slowed down and cardinality is the suspect

What it does

Cardinality, the number of unique label combinations, drives Prometheus memory, storage and query cost, and this skill hunts for its causes. The agent starts with tsdb_stats, whose series counts by metric name, label value counts by label name and memory by label name rank the worst offenders, then inspects suspects with the series and label_values tools and uses targets_metadata to see which targets expose a metric and so where a fix belongs.

Further checks track live growth with prometheus_tsdb_head_series, churn from series-created rates and attribution to targets with scrape_series_added, and a count by query compares per-label series counts to find the driver. Unbounded label values such as IDs, UUIDs, URL paths and timestamps are flagged. Proposals state series before and after and arrive as concrete metric_relabel_configs or recording rule YAML. The tools come from a connected Prometheus MCP server.

When your agent uses it

  • Series counts or Prometheus memory use keep growing
  • Queries have slowed down and cardinality is the suspect
  • tsdb_stats shows a label with a huge number of values
  • Deciding whether to relabel, drop or aggregate a noisy metric

Example prompts

  • “Prometheus memory doubled this month. Find which metrics and labels are responsible.”
  • “Which label makes http_requests_total so large, and what would dropping it save?”
  • “Write metric_relabel_configs that remove the user_id label from the checkout metrics.”

Requirements

  • A connected Prometheus MCP server and its tools
  • Compatibility (from SKILL.md): Requires the tools of a connected Prometheus MCP server

What it can do on your machine

Read from SKILL.md and the folder at commit 856fb45. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires the tools of a connected Prometheus MCP server

    From compatibility in the SKILL.md frontmatter.

Context cost

Prometheus Cardinality Optimizer loads about 547 tokens when it runs. Until then it costs about 65 tokens; SKILL.md has 232 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~65
When it runs · the whole SKILL.md, loaded when a task matches
~547

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from prometheus/prometheus-mcp at commit 856fb45, republished under its Apache-2.0 licence (© prometheus). 232 words, ~547 tokens.

Download SKILL.mdSave it as .claude/skills/optimize-high-cardinality/SKILL.md (or your agent's skills folder).
name
optimize-high-cardinality
description
Find and reduce high-cardinality metrics and labels. Use when series counts or memory grow, queries slow down, or tsdb_stats shows label explosions; pinpoints offending labels and proposes relabeling, dropping, and aggregation fixes.
compatibility
Requires the tools of a connected Prometheus MCP server
license
Apache-2.0

Exploring, Identifying, and Optimizing High-Cardinality Metrics

Cardinality (the number of unique label combinations) drives Prometheus memory, storage, and query cost. Find the metrics and labels responsible for series explosions and propose fixes that keep the signal while shedding the cost.

Getting oriented

  • tsdb_stats is the primary instrument: seriesCountByMetricName ranks the biggest metrics, labelValueCountByLabelName exposes labels with huge value sets, and memoryInBytesByLabelName shows what they cost.
  • series and label_values let you inspect a suspect metric's actual label combinations and values.
  • targets_metadata shows which targets expose a metric, i.e. where a fix would need to be applied.
  • Prometheus's own TSDB metrics track cardinality live: range_query prometheus_tsdb_head_series for overall growth, rate(prometheus_tsdb_head_series_created_total[5m]) for churn, and topk(10, scrape_series_added) to attribute new series to the targets creating them.

Topics worth exploring

Treat these as starting points and follow the biggest numbers:

  • Which label drives a metric's cardinality: compare per-label series counts, e.g. with query: count by (path) (http_requests_total) Repeat for other labels; the grouping that yields the most series is the driver.
  • Unbounded label value review: IDs, UUIDs, URL paths with embedded parameters, timestamps, etc. label_values on a suspect label makes these obvious.
  • Growth over time: range_query count(<metric>) to see whether cardinality is stable, stepped (deploys), or unbounded (leaking labels).

Suggesting changes

Quantify each proposal's impact (series before vs after) since advice depends on results of investigation, provide concrete metric_relabel_configs or recording rule YAML or suggested next actions.

© prometheus, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in pkg/mcp/assets/skills/optimize-high-cardinality of prometheus/prometheus-mcp.

Open the folder on GitHubat commit 856fb45

Compare with similar skills

Prometheus Cardinality Optimizer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Prometheus Cardinality Optimizer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Prometheus Cardinality Optimizer this skillprometheus/prometheus-mcp117—~547Automated safety check: PassApache-2.0
Syncmetapawurb/hotpath-rs1.9k—~1.2kAutomated safety check: NotesMIT
Archestra Dev Observabilityarchestra-ai/archestra4.3k—~1.2kAutomated safety check: PassCustom licence
Frontmcp Observabilityagentfront/frontmcp146—~4.6kAutomated safety check: PassApache-2.0
AWS Cost OperationsMicrock/ordinary-claude-skills4011 repos~2.5kAutomated safety check: PassCustom licence
Grafana Observabilityautomateyournetwork/netclaw674—~2.7kAutomated safety check: NotesApache-2.0

Similar skills

  • Syncmeta

    pawurb/hotpath-rs

    Sync changes from the hotpath, hotpath-macros and hotpath-drain crates to their meta counterparts (hotpath-meta, hotpath-macros-meta and hotpath-drain-meta).

    1.9k GitHub stars~1.2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Archestra Dev Observability

    archestra-ai/archestra

    A skill your agent uses when changing Archestra tracing, metrics, OpenTelemetry, Tempo, Grafana, Prometheus, LLM/MCP spans, observability labels, or local observability setup.

    4.3k GitHub stars~1.2k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Frontmcp Observability

    agentfront/frontmcp

    A skill your agent uses when adding tracing, structured logging, metrics, or monitoring to a FrontMCP server.

    146 GitHub stars~4.6k tokensUpdated today
    DevOps & CloudAuto-check passed
  • AWS Cost Operations

    Microck/ordinary-claude-skills

    This skill provides AWS cost optimization, monitoring, and operational best practices with integrated MCP servers for billing analysis, cost estimation, observability, and security assessment.

    401 GitHub starsUsed in 1 repo~2.5k tokens
    DevOps & CloudAuto-check passed
  • Grafana Observability

    automateyournetwork/netclaw

    Grafana observability platform — dashboards, Prometheus PromQL, Loki LogQL, alerting, incidents, OnCall schedules, annotations, datasource queries, panel rendering (75+ tools).

    674 GitHub stars~2.7k tokensUpdated 2 days ago
    DevOps & CloudAuto-check: notes
  • Queries live Prometheus metrics and manages Grafana dashboards as code for Happy's infrastructure, using the grafanactl CLI and the Grafana datasource proxy API.

    24k GitHub stars~2k tokensUpdated today
    DevOps & CloudAuto-check: notes

More from prometheus/prometheus-mcp

  • Prometheus System Health Check

    prometheus/prometheus-mcp

    Builds a picture of whether Prometheus itself is healthy and successfully monitoring its targets, covering readiness, firing alerts, target health and TSDB load.

    117 GitHub stars~584 tokensUpdated 2 days ago
    Auto-check passed
  • Prometheus Top Resource Consumers

    prometheus/prometheus-mcp

    Find the top CPU, memory, or disk consumers. Use for capacity reviews, noisy-neighbor hunts, and top-N questions about which jobs, pods, or instances use the…

    117 GitHub stars~569 tokensUpdated 2 days ago
    Auto-check passed
  • Prometheus Error Rate Investigator

    prometheus/prometheus-mcp

    Quantifies elevated error rates with PromQL, compares them to a baseline, and isolates which jobs or instances an error spike is concentrated in.

    117 GitHub stars~592 tokensUpdated 2 days ago
    Auto-check passed
  • Prometheus Rules Review

    prometheus/prometheus-mcp

    Audits Prometheus recording and alerting rules through a connected Prometheus MCP server, finds gaps and noisy alerts, and drafts improved rule-group YAML.

    117 GitHub stars~765 tokensUpdated 2 days ago
    Auto-check passed
  • Finds where a Prometheus metric stops existing, whether at the target, the scrape, relabeling or the query, using the tools of a connected Prometheus MCP server.

    117 GitHub stars~587 tokensUpdated 2 days ago
    Auto-check passed
  • Tune Prometheus Config

    prometheus/prometheus-mcp

    Review and tune Prometheus configuration and performance. An agent skill from prometheus/prometheus-mcp.

    117 GitHub stars~724 tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Prometheus Cardinality Optimizer

What does Prometheus Cardinality Optimizer do?

Finds the metrics and labels behind a Prometheus series explosion using a connected Prometheus MCP server, then proposes relabeling, dropping or recording-rule fixes with measured impact. Cardinality, the number of unique label combinations, drives Prometheus memory, storage and query cost, and this skill hunts for its causes. The agent starts with tsdb_stats, whose series counts by metric name, label value counts by label name and memory by label name rank the worst offenders, then inspects suspects with the series and label_values tools and uses targets_metadata to see which targets expose a metric and so where a fix belongs.

When should I use Prometheus Cardinality Optimizer?

Prometheus Cardinality Optimizer fits situations like: series counts or Prometheus memory use keep growing; queries have slowed down and cardinality is the suspect; tsdb_stats shows a label with a huge number of values; deciding whether to relabel, drop or aggregate a noisy metric.

How do I install Prometheus Cardinality Optimizer in Claude Code?

Run `npx skills add prometheus/prometheus-mcp --skill optimize-high-cardinality -a claude-code`. Or copy the skill folder (pkg/mcp/assets/skills/optimize-high-cardinality in prometheus/prometheus-mcp) into .claude/skills/optimize-high-cardinality in your project. Claude Code loads it when a task matches its description.

How do I install Prometheus Cardinality Optimizer in Codex?

Run `npx skills add prometheus/prometheus-mcp --skill optimize-high-cardinality -a codex`. Or copy the skill folder (pkg/mcp/assets/skills/optimize-high-cardinality in prometheus/prometheus-mcp) into .agents/skills/optimize-high-cardinality in your project. Codex loads it when a task matches its description.

Can I use Prometheus Cardinality Optimizer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add prometheus/prometheus-mcp --skill optimize-high-cardinality -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimize-high-cardinality, .gemini/skills/optimize-high-cardinality, .github/skills/optimize-high-cardinality and .opencode/skills/optimize-high-cardinality in your project.

What does Prometheus Cardinality Optimizer need to run?

SKILL.md names no scripts, command-line tools or credentials: Prometheus Cardinality Optimizer is instructions for the agent only. Our summary lists: A connected Prometheus MCP server and its tools. Compatibility (from SKILL.md): Requires the tools of a connected Prometheus MCP server.

Does Prometheus Cardinality Optimizer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Prometheus Cardinality Optimizer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Prometheus Cardinality Optimizer use?

Prometheus Cardinality Optimizer is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Prometheus Cardinality Optimizer use?

About 547 tokens (SKILL.md is roughly 2.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Prometheus Cardinality Optimizer?

Skills that share tags, products or a category with Prometheus Cardinality Optimizer: Syncmeta (pawurb/hotpath-rs, 1.9k stars), Archestra Dev Observability (archestra-ai/archestra, 4.3k stars), Frontmcp Observability (agentfront/frontmcp, 146 stars) and AWS Cost Operations (Microck/ordinary-claude-skills, 401 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Prometheus Cardinality Optimizer?

prometheus (a GitHub organization) maintains it in prometheus/prometheus-mcp, which has 117 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 4, 2026.

Source: prometheus/prometheus-mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.