From 3a45c04bc2c1b54fccf0d9a7906deb9db90a8485 Mon Sep 17 00:00:00 2001 From: davidlin20dev Date: Thu, 4 Jun 2026 23:24:20 -0600 Subject: [PATCH] refactor(executor): construct the executor metrics scope once webhook and plugin setup each created a separate promutils.NewScope("executor"). Two independent scopes sharing the "executor:" prefix risk a duplicate-registration panic on the default Prometheus registry if they ever register a like-named metric. Build one base scope and give the webhook and plugin distinct sub-scopes (executor:webhook:, executor:plugin:). Closes #7456 Signed-off-by: davidlin20dev --- executor/setup.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/executor/setup.go b/executor/setup.go index ab0eb6f930..7356229859 100644 --- a/executor/setup.go +++ b/executor/setup.go @@ -109,7 +109,9 @@ func Setup(ctx context.Context, sc *app.SetupContext) error { podNamespace = sc.Namespace } - if err := webhookPkg.Setup(ctx, kubeClient, wCfg, podNamespace, promutils.NewScope("executor"), mgr); err != nil { + executorScope := promutils.NewScope("executor") + + if err := webhookPkg.Setup(ctx, kubeClient, wCfg, podNamespace, executorScope.NewSubScope("webhook"), mgr); err != nil { return fmt.Errorf("executor: webhook setup failed: %w", err) } @@ -121,7 +123,7 @@ func Setup(ctx context.Context, sc *app.SetupContext) error { setupCtx := plugin.NewSetupContext( mgr, nil, nil, nil, nil, "TaskAction", - promutils.NewScope("executor"), + executorScope.NewSubScope("plugin"), ) registry := plugin.NewRegistry(setupCtx, pluginmachinery.PluginRegistry()) if err := registry.Initialize(ctx); err != nil {