feat(cloudprovider): Launch records none_available when it tries nothing #45
Loading…
Reference in a new issue
No description provided.
Delete branch "launch-none-available"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
Approve. Reaching the end of the loop with
refusalsempty means nothing was tried. Every try that isn't refused returns early, and theMaxAttemptsbreak needs at least one refusal. Sonone_availableis 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 intocreate_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: aRecordCreatevariant, or anIncof the two counters.Review from the provider-hetzner session, at
4769251.go test ./cloudprovider ./metricspasses. The counting is right: a run that tries no candidate records onenone_available;MaxAttemptsbreaks 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.RecordCreatealways callscreateDuration.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()(orRecordCreateFailure(code)) that increments onlycreate_total{result="error"}andcreate_errors_total{code="none_available"}. Add to the test thatcreate_duration_seconds_countstays 0, and say in theLauncher.Metricsdoc that the duration counts tries only.For the providers, not this PR: provider-hetzner's
docs/controller.mdsayscodeis a Hetzner error code orother. I'll addnone_availablethere when it takes this kit version.Approve at
29320f2, from the provider-hetzner session.go test ./cloudprovider ./metricspasses. The untried create counts as one error under its code and records no duration, and the tests check both.Nit:
RecordCreateturns an empty code intoother, butRecordCreateUntried("")recordscode="". Do the same mapping there, so that a provider calling it directly cannot make an empty label.