Skip to content

🌱 Add bounded self-metrics for GPU utilization worker - #23243

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
telemetry/gpu-utilization-worker-metrics
Open

🌱 Add bounded self-metrics for GPU utilization worker#23243
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
telemetry/gpu-utilization-worker-metrics

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Fixes #23242

What

Adds bounded Prometheus metrics for the GPU utilization background worker (pkg/api/gpu_utilization_worker.go), which polls active GPU reservations, queries pods/GPU nodes per cluster, optionally scrapes DCGM, and sends threshold alerts — entirely outside the HTTP request path, so it had no signal on /metrics beyond slog error logs.

New metrics (pkg/api/metrics/metrics.go)

  • console_gpu_util_scrape_cycles_total (counter) — completed poll cycles
  • console_gpu_util_scrape_duration_seconds (histogram) — poll cycle duration
  • console_gpu_util_reservation_collect_total{outcome} (counter) — fixed outcome set: success/pods_error/nodes_error/snapshot_error
  • console_gpu_util_dcgm_scrape_errors_total (counter)
  • console_gpu_util_alert_send_errors_total (counter)

No label is derived from reservation ID, cluster name, or any other unbounded value — the outcome label only ever takes one of the four fixed constants.

Other changes

  • Two new panels added to the existing Grafana self-metrics dashboard (deploy/grafana/console-self-metrics-dashboard.json): poll-cycle rate/p95 duration, and collection outcomes/DCGM/alert error rates.
  • New unit test (pkg/api/metrics/metrics_test.go) asserting all five series surface on /metrics with expected label values.

Backend status

No observability backend is confirmed for this repo (per prior audit #23055). This PR only adds in-process Prometheus client metrics exposed on the existing /metrics endpoint — no exporter or external data flow is introduced.

Testing

  • go build ./... — passes
  • go test ./pkg/api/... ./pkg/api/metrics/... — passes (including new TestGPUUtilRecordFunctions)
  • gofmt -l — clean
  • Dashboard JSON validated with json.load

— hive: agent=telemetry backend=copilot model=claude-sonnet-4-6

@kubestellar-hive kubestellar-hive Bot added the hold Blocked — do not touch label Sep 7, 2026
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human sign-off on the direction, not on the code.

This PR's only tracked rationale is #23242, which the hive filed itself — issue #23242 was filed by kubestellar-hive[bot] and no human has acknowledged it. An agent-filed issue does not, on its own, establish that anyone agreed to the direction (hivecommons/hive#5117).

The change may well be right; nothing here is a review of it. To release the hold, acknowledge the direction on that issue — comment on it, assign yourself, or add the approved-direction label — and remove the hold label here.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 7, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign eeshaansa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit e49e6bd
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a9fc18a80bb1e0009f8243c

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Sep 7, 2026
@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 7, 2026
Fixes #23242

The GPU utilization background worker (pkg/api/gpu_utilization_worker.go)
polls active reservations, queries pods/GPU nodes per cluster, optionally
scrapes the DCGM exporter, and sends threshold alerts — entirely outside
the HTTP request path, so it was invisible to console_http_requests_total
and console_http_request_duration_seconds. Failures were logged via slog
only, with no scraped/aggregated signal.

Adds five bounded Prometheus metrics:
- console_gpu_util_scrape_cycles_total (counter)
- console_gpu_util_scrape_duration_seconds (histogram)
- console_gpu_util_reservation_collect_total{outcome} (counter, fixed
  outcome set: success/pods_error/nodes_error/snapshot_error)
- console_gpu_util_dcgm_scrape_errors_total (counter)
- console_gpu_util_alert_send_errors_total (counter)

No new label is derived from reservation ID, cluster name, or any other
unbounded value. Extends the existing Grafana self-metrics dashboard with
two panels for these metrics and adds a unit test asserting all five
series surface on /metrics with the expected label values.

Signed-off-by: kubestellar-hive[bot] <223556219+Copilot@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 8, 2026
@kubestellar-hive
kubestellar-hive Bot force-pushed the telemetry/gpu-utilization-worker-metrics branch from 7624ad9 to e49e6bd Compare September 8, 2026 08:04
@kubestellar-prow kubestellar-prow Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 8, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. hold Blocked — do not touch needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[telemetry] GPU utilization background worker has no self-metrics

1 participant