prometheus / prometheus/prometheus

Scrape limit on series before relabeling

Open
#16,514 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/scraping kind/feature priority/Pmaybe
Dominant language
Go
Stars
66.1k
Forks
10.8k
Avg merge
2d 1h
Merged PRs (30d)
131

Description

Proposal

A situation where an exporter is unexpectedly generating millions of metrics but Prometheus is configured to drop them via relabelling, can result in excessive memory usage because all dropped series go into a cache per target.

Prometheus allows a limit on the number of series after relabeling, but you can't directly set a limit on the number of series in a scrape.
You can put a limit on the number of bytes in a scrape, but this is somewhat indirect.

My proposal is to add scraped_sample_limit or perhaps something like sample_limit_before_relabelling.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by tracing the existing scrape byte limit, post-relabel series limit, and relabeling flow to determine where a pre-relabel sample limit belongs; done means an agreed configuration and behavior for limiting scraped series before relabeling.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.