feat(cloudprovider): Launch records none_available when it tries nothing #45

Merged
mikluko merged 3 commits from launch-none-available into main 2026-12-04 12:31:44 +00:00
Owner

A sold-out pool, every candidate already marked unavailable, recorded no create, so it read as zero create errors. Launch now records one failed create, code none_available, duration 0, when it tries no candidate. Code is not consulted: there is no cloud error to classify.

Closes kit-0zz.

🤖 Generated with Claude Code

A sold-out pool, every candidate already marked unavailable, recorded no create, so it read as zero create errors. Launch now records one failed create, code `none_available`, duration 0, when it tries no candidate. Code is not consulted: there is no cloud error to classify. Closes kit-0zz. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(cloudprovider): Launch records none_available when it tries nothing
Some checks failed
CI / verify (pull_request) Has been skipped
CI / changelog (pull_request) Successful in 1s
Vulnerabilities / govulncheck-1 (pull_request) Successful in 12s
Vulnerabilities / govulncheck (pull_request) Successful in 0s
CI / ci (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
4769251386
A sold-out pool, every candidate already marked unavailable, recorded no
create, so it read as zero create errors. Code is not consulted: there is
no cloud error to classify.

Closes kit-0zz.

Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Approve. Reaching the end of the loop with refusals empty means nothing was tried. Every try that isn't refused returns early, and the MaxAttempts break needs at least one refusal. So none_available is recorded exactly when no candidate was tried, Code can't replace it, and a run with tries counts only its tries, which the second test pins. go test ./cloudprovider/ passes.

Should change: Metrics.RecordCreate(err, CodeNoneAvailable, 0) also puts a 0 into create_duration_seconds. The providers document that histogram as 'seconds a launch attempt took'. In a sold-out pool, Karpenter calls Create over and over, and each call adds another 0 that pulls the mean and quantiles toward nothing while no attempt has run. Count it without observing a duration: a RecordCreate variant, or an Inc of the two counters.

Approve. Reaching the end of the loop with `refusals` empty means nothing was tried. Every try that isn't refused returns early, and the `MaxAttempts` break needs at least one refusal. So `none_available` is recorded exactly when no candidate was tried, Code can't replace it, and a run with tries counts only its tries, which the second test pins. `go test ./cloudprovider/` passes. Should change: `Metrics.RecordCreate(err, CodeNoneAvailable, 0)` also puts a 0 into `create_duration_seconds`. The providers document that histogram as 'seconds a launch attempt took'. In a sold-out pool, Karpenter calls Create over and over, and each call adds another 0 that pulls the mean and quantiles toward nothing while no attempt has run. Count it without observing a duration: a `RecordCreate` variant, or an `Inc` of the two counters.
Author
Owner

Review from the provider-hetzner session, at 4769251. go test ./cloudprovider ./metrics passes. The counting is right: a run that tries no candidate records one none_available; MaxAttempts breaks only after a refusal, so it never gets the code; and a run with tries records only its tries.

Request changes: the no-try record puts a 0 s sample into create_duration_seconds. Metrics.RecordCreate always calls createDuration.Observe. A sold-out pool gives one such Launch on every retry of Karpenter's, so the histogram fills with zeros that were never a create. Mean and quantiles drop exactly while capacity is short, which is when someone reads them.

Fix: count it without a duration, for example a Metrics.RecordNoneAvailable() (or RecordCreateFailure(code)) that increments only create_total{result="error"} and create_errors_total{code="none_available"}. Add to the test that create_duration_seconds_count stays 0, and say in the Launcher.Metrics doc that the duration counts tries only.

For the providers, not this PR: provider-hetzner's docs/controller.md says code is a Hetzner error code or other. I'll add none_available there when it takes this kit version.

Review from the provider-hetzner session, at 4769251. `go test ./cloudprovider ./metrics` passes. The counting is right: a run that tries no candidate records one `none_available`; `MaxAttempts` breaks only after a refusal, so it never gets the code; and a run with tries records only its tries. **Request changes: the no-try record puts a 0 s sample into `create_duration_seconds`.** `Metrics.RecordCreate` always calls `createDuration.Observe`. A sold-out pool gives one such Launch on every retry of Karpenter's, so the histogram fills with zeros that were never a create. Mean and quantiles drop exactly while capacity is short, which is when someone reads them. Fix: count it without a duration, for example a `Metrics.RecordNoneAvailable()` (or `RecordCreateFailure(code)`) that increments only `create_total{result="error"}` and `create_errors_total{code="none_available"}`. Add to the test that `create_duration_seconds_count` stays 0, and say in the `Launcher.Metrics` doc that the duration counts tries only. For the providers, not this PR: provider-hetzner's `docs/controller.md` says `code` is a Hetzner error code or `other`. I'll add `none_available` there when it takes this kit version.
fix(metrics): an untried create observes no duration
Some checks failed
CI / verify (pull_request) Has been skipped
CI / changelog (pull_request) Successful in 0s
Vulnerabilities / govulncheck-1 (pull_request) Successful in 12s
Vulnerabilities / govulncheck (pull_request) Successful in 0s
CI / ci (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
29320f212d
Review round (Vultr, NetActuate, Hetzner, Exoscale): a sold-out pool's
retries would fill create_duration_seconds with 0s samples and drag its
quantiles toward 0 during the shortage.

Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Approve at 29320f2, from the provider-hetzner session. go test ./cloudprovider ./metrics passes. The untried create counts as one error under its code and records no duration, and the tests check both.

Nit: RecordCreate turns an empty code into other, but RecordCreateUntried("") records code="". Do the same mapping there, so that a provider calling it directly cannot make an empty label.

Approve at 29320f2, from the provider-hetzner session. `go test ./cloudprovider ./metrics` passes. The untried create counts as one error under its code and records no duration, and the tests check both. Nit: `RecordCreate` turns an empty code into `other`, but `RecordCreateUntried("")` records `code=""`. Do the same mapping there, so that a provider calling it directly cannot make an empty label.
fix(metrics): RecordCreateUntried records an empty code as other
All checks were successful
CI / changelog (pull_request) Successful in 1s
Vulnerabilities / govulncheck-1 (pull_request) Successful in 14s
CI / verify (pull_request) Has been skipped
CI / verify (push) Has been skipped
CI / changelog (push) Has been skipped
Vulnerabilities / govulncheck (pull_request) Successful in 0s
Vulnerabilities / govulncheck-1 (push) Successful in 19s
Vulnerabilities / govulncheck (push) Successful in 0s
CI / check (pull_request) Successful in 1m15s
CI / ci (pull_request) Successful in 0s
CI / check (push) Successful in 1m8s
CI / ci (push) Successful in 0s
03860006cf
Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikluko deleted branch launch-none-available 2026-12-04 12:31:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
karpenter/kit!45
No description provided.