Skip to content

ui: add opt-in targets scrape proxy for viewing metrics#18443

Open
charanbhatia wants to merge 6 commits intoprometheus:mainfrom
charanbhatia:ui/proxy-target-scrape
Open

ui: add opt-in targets scrape proxy for viewing metrics#18443
charanbhatia wants to merge 6 commits intoprometheus:mainfrom
charanbhatia:ui/proxy-target-scrape

Conversation

@charanbhatia
Copy link
Copy Markdown

@charanbhatia charanbhatia commented Apr 3, 2026

Add --web.enable-target-scrape-proxy, GET /api/v1/targets/scrape, and View metrics on the Targets page (Mantine + classic UI). Proxy scrapes only active targets using the pool's HTTP client, with size and timeout limits.

Which issue(s) does the PR fix:
Targets listed in the UI are often only reachable from Prometheus (e.g. in-cluster Kubernetes pods), so the scrape URL cannot be opened from the browser. This adds an opt-in way to run that scrape inside Prometheus and show the raw body in the UI, addressing the linked feature discussion (CLI-gated / flag approach agreed with maintainers).

Fixes #17801

Release notes for end users (ALL commits must be considered).

[FEATURE] UI: Add `--web.enable-target-scrape-proxy` and `GET /api/v1/targets/scrape` with a "View metrics" action on the Targets page (Mantine and classic UI).

Add --web.enable-target-scrape-proxy, GET /api/v1/targets/scrape, and
View metrics on the Targets page (Mantine + classic UI). Proxy scrapes
only active targets using the pool's HTTP client, with size and timeout
limits.

Signed-off-by: Charanjeet Bhatia <[email protected]>
Made-with: Cursor
@charanbhatia charanbhatia requested review from a team and juliusv as code owners April 3, 2026 17:44
Charanjeet Bhatia added 4 commits April 3, 2026 23:38
- Refresh openapi_3.1/3.2 golden YAML for /targets/scrape.
- Refactor TargetScrapeProxyContext to match existing context style and satisfy Prettier.

Signed-off-by: Charanjeet Bhatia <[email protected]>
Made-with: Cursor
- Pass enableTargetScrapeProxy in App.test.tsx for AppProps.
- Use for range 1024 in scrape proxy test per modernize linter.

Signed-off-by: Charanjeet Bhatia <[email protected]>
Made-with: Cursor
Use atomic.Int64 for handler delay so the httptest server and test do not race.

Signed-off-by: Charanjeet Bhatia <[email protected]>
Made-with: Cursor
depguard forbids sync/atomic; uber atomic matches project convention.

Signed-off-by: Charanjeet Bhatia <[email protected]>
Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proxy target endpoint scraping via prometheus itself

1 participant