Skip to content

fix(core): show the Metrics tab for covered endpoints - #6050

Merged
norman-abramovitz merged 3 commits into
cloudfoundry:developfrom
nabramovitz:norm/fix/metrics-tab
Oct 22, 2026
Merged

norman-abramovitz merged 3 commits into
cloudfoundry:developfrom
nabramovitz:norm/fix/metrics-tab

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

Summary

The Metrics tab has not appeared on an application, a Cloud Foundry or a Kubernetes node page since 858d56b (May 2026), even with a metrics endpoint registered and connected. When it did open, its charts said "No results found" for the first 10 seconds. This PR fixes both.

What changes

Metrics tab (fix(core): show the Metrics tab for covered endpoints)

  • Those pages add the tab when EndpointsService.hasMetrics() says a metrics endpoint covers the endpoint. hasMetrics() read endpoint.metricsAvailable, which only the ngrx endpoint reducer set, from the metrics link in the endpoint's metadata. That reducer was removed in 858d56b and nothing replaced it.
  • hasMetrics() now reads metadata.metrics, as endpointHasMetrics() already did. That helper had no callers. The helper that read the flag and the flag itself are removed.

First chart request (fix(metrics): send the time window on first load)

  • The parent range selector started the range manager before it subscribed to its requests. Starting the manager sends the first windowed request at once, on a plain Subject, so the charts missed it and fetched their base request, which has no start or end.
  • Prometheus rejected that request, and every chart said "No results found" until the first 10-second poll. The selector now subscribes first, then starts the manager.

Tests

  • endpoints.service.spec.ts: hasMetrics() is true for an endpoint whose metadata carries a metrics link. It failed on develop.
  • metrics-parent-range-selector.component.spec.ts: the first request the charts receive carries the time window. It failed on develop.
  • make check gate: passed (4583 tests passed, 1 skipped). Go lint: 0 issues in all seven modules.

Live check

Against a Cloud Foundry lab with a real Prometheus endpoint connected: on an application page the Metrics tab appears, and its first chart requests carry the time window (start and end set, all 200) instead of the base request Prometheus rejected. Checked before and after the rebase onto develop f88c08f; the second run was on develop + this branch + #6044.

Release note: changelog.d/0025-metrics-tab.md.

AI disclosure (RFC-0047): prepared with AI coding assistance; reviewed by the author.

The application, Cloud Foundry and Kubernetes node pages add a Metrics
tab when EndpointsService.hasMetrics() says a metrics endpoint covers
the endpoint. hasMetrics() read endpoint.metricsAvailable, which only
the ngrx endpoint reducer set, from the metrics link in the endpoint's
metadata. That reducer went in 858d56b and nothing replaced it, so
the tab has not appeared since, even with Prometheus connected.

Read metadata.metrics, as endpointHasMetrics() already did; it had no
callers. Remove the helper that read the flag and the flag itself.
The parent range selector started the range manager before it
subscribed to its requests. Starting the manager commits the first
windowed request at once, on a plain Subject, so the charts missed it
and fetched their base request, which has no start or end. Prometheus
rejected it, and every chart said "No results found" until the first
10 second poll.

Subscribe first, then start the manager.

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@norman-abramovitz
norman-abramovitz merged commit bb5e97b into cloudfoundry:develop Oct 22, 2026
24 checks passed
@nabramovitz
nabramovitz deleted the norm/fix/metrics-tab branch October 22, 2026 23:51
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.

2 participants