Skip to content

feat(controller): export capacity metrics over OTLP - #1651

Open
hpliStartAgain wants to merge 2 commits into
opensandbox-group:mainfrom
hpliStartAgain:feat/controller-capacity-metrics
Open

feat(controller): export capacity metrics over OTLP#1651
hpliStartAgain wants to merge 2 commits into
opensandbox-group:mainfrom
hpliStartAgain:feat/controller-capacity-metrics

Conversation

@hpliStartAgain

Copy link
Copy Markdown
Contributor

Fixes #1650.

Summary

  • export low-cardinality Pool and BatchSandbox capacity gauges over OTLP/HTTP
  • calculate Pool CPU and memory requests from actual Pod specs with Kubernetes scheduler-equivalent semantics
  • run the exporter only on the elected controller and keep telemetry disabled unless an explicit OTLP endpoint is configured
  • document metric names, dimensions, units, and the boundary with controller-runtime and kubelet/cAdvisor metrics

The existing controller-runtime Prometheus endpoint is unchanged. Capacity metrics omit sandbox, BatchSandbox, and Pod identifiers; current values are aggregated by namespace, Pool, lifecycle phase, allocation mode, and bounded state values.

Testing

  • Not run (explain why)
  • Unit tests
  • Integration tests
  • e2e / manual verification

Commands run:

  • cd kubernetes && go test ./internal/controller -run 'TestCapacityMetrics' -count=1
  • cd kubernetes && make test
  • cd kubernetes && make lint
  • cd kubernetes && make build
  • cd docs && corepack pnpm docs:build
  • ./scripts/verify-license.sh
  • git diff --check

Breaking Changes

  • None
  • Yes (describe impact and migration path)

The feature is additive and defaults to disabled. It activates only when OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT is explicitly set.

Checklist

  • Linked Issue or clearly described motivation
  • Added/updated docs (if needed)
  • Added/updated tests (if needed)
  • Security impact considered
  • Backward compatibility considered

@github-actions github-actions Bot added component/k8s For kubernetes runtime documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 27, 2026
@hpliStartAgain
hpliStartAgain marked this pull request as ready for review August 27, 2026 02:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df7540a9b2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread kubernetes/internal/controller/capacity_metrics.go Outdated
hpliStartAgain and others added 2 commits August 27, 2026 11:41
Provide low-cardinality Pool and BatchSandbox capacity signals so operators can size warm pools and estimate requested resource costs without duplicating runtime usage metrics.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Keep capacity resource gauges aligned with the Pool reconciler by excluding mislabeled and stale Pods that are not owned by the current Pool UID.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@hpliStartAgain
hpliStartAgain force-pushed the feat/controller-capacity-metrics branch from 8a2593d to 15be023 Compare August 27, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/k8s For kubernetes runtime documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

controller: expose low-cardinality sandbox and pool capacity metrics

1 participant