Skip to content

feat: log and meter reconcile skips in QController runtime#664

Merged
talos-bot merged 1 commit into
cosi-project:mainfrom
oguzkilcan:feat/qcontroller-skip-reconcile-log
May 7, 2026
Merged

feat: log and meter reconcile skips in QController runtime#664
talos-bot merged 1 commit into
cosi-project:mainfrom
oguzkilcan:feat/qcontroller-skip-reconcile-log

Conversation

@oguzkilcan
Copy link
Copy Markdown
Member

Previously qtransform swallowed SkipReconcileTag errors and returned nil, so the QRuntime saw a plain success and the reason behind the skip was lost. The runtime now detects the tag itself, emits a dedicated reconcile skipped log line carrying the original reason, and increments a new qcontroller_skips expvar metric — while still treating the cycle like a success for backoff purposes.

Previously qtransform swallowed `SkipReconcileTag` errors and returned nil, so the QRuntime saw a plain success and the reason behind the skip was lost. The runtime now detects the tag itself, emits a dedicated `reconcile skipped` log line carrying the original reason, and increments a new `qcontroller_skips` expvar metric — while still treating the cycle like a success for backoff purposes.

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
Copilot AI review requested due to automatic review settings May 7, 2026 17:53
@github-project-automation github-project-automation Bot moved this to To Do in Planning May 7, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning May 7, 2026
@github-project-automation github-project-automation Bot moved this from In Review to Approved in Planning May 7, 2026
@oguzkilcan
Copy link
Copy Markdown
Member Author

/m

@talos-bot
Copy link
Copy Markdown
Collaborator

@oguzkilcan merge was not performed: push: To https://github.com/cosi-project/runtime.git
! [remote rejected] main -> main (cannot lock ref 'refs/heads/main': is at fc693cb but expected 282c9a0)
error: failed to push some refs to 'https://github.com/cosi-project/runtime.git'

@talos-bot talos-bot merged commit fc693cb into cosi-project:main May 7, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in Planning May 7, 2026
@utkuozdemir
Copy link
Copy Markdown
Member

@oguzkilcan merge was not performed: push: To https://github.com/cosi-project/runtime.git
! [remote rejected] main -> main (cannot lock ref 'refs/heads/main': is at fc693cb but expected 282c9a0)
error: failed to push some refs to 'https://github.com/cosi-project/runtime.git'

I got this as well

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures SkipReconcileTag-based “skips” are no longer silently treated as plain successes by the queue-controller runtime by propagating the tagged error out of qtransform and handling it explicitly in qruntime with dedicated logging and a new expvar metric.

Changes:

  • Add qcontroller_skips expvar metric to count skipped reconcile cycles per QController.
  • Update qruntime to detect SkipReconcileTag, log reconcile skipped with the original reason, and treat it as success for backoff.
  • Stop swallowing SkipReconcileTag in qtransform so the runtime can observe and report skip reasons; centralize reconcile-outcome log level selection via QJob.LogLevel().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/controller/runtime/metrics/metrics.go Adds QControllerSkips expvar map metric.
pkg/controller/runtime/internal/qruntime/qruntime.go Detects skip-tagged errors, logs a dedicated “reconcile skipped” message, and increments the new skip metric.
pkg/controller/runtime/internal/qruntime/qitem.go Introduces QJob.LogLevel() helper for consistent reconcile-outcome log levels.
pkg/controller/generic/qtransform/qtransform.go Propagates SkipReconcileTag errors (instead of returning nil) so the runtime can log/meter skip reasons.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 17 to 25
"github.com/cenkalti/backoff/v4"
"github.com/siderolabs/gen/xerrors"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/sync/errgroup"
"golang.org/x/time/rate"

"github.com/cosi-project/runtime/pkg/controller"
"github.com/cosi-project/runtime/pkg/controller/generic/qtransform"
"github.com/cosi-project/runtime/pkg/controller/runtime/internal/adapter"
Comment on lines 268 to 272
}

if xerrors.TagIs[SkipReconcileTag](err) {
return nil
return err
}
Comment on lines +277 to 287
skipped := xerrors.TagIs[qtransform.SkipReconcileTag](reconcileError)

if adapter.metricsEnabled {
if reconcileError != nil {
switch {
case skipped:
metrics.QControllerSkips.Add(adapter.Name, 1)
case reconcileError != nil:
metrics.QControllerCrashes.Add(adapter.Name, 1)
} else if interval != 0 {
case interval != 0:
metrics.QControllerRequeues.Add(adapter.Name, 1)
}
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.

5 participants