Skip to content

refactor(executor): construct the executor metrics scope once#7475

Merged
pingsutw merged 1 commit into
flyteorg:mainfrom
davidlin20dev:refactor/dedupe-executor-scope
Jun 17, 2026
Merged

refactor(executor): construct the executor metrics scope once#7475
pingsutw merged 1 commit into
flyteorg:mainfrom
davidlin20dev:refactor/dedupe-executor-scope

Conversation

@davidlin20dev

Copy link
Copy Markdown
Contributor

Tracking issue

Closes #7456

Why are the changes needed?

executor/setup.go constructed promutils.NewScope("executor") twice: once for the
webhook setup and once for the plugin setup context. Two independent scopes sharing
the same executor: prefix are a latent duplicate-registration panic on the default
Prometheus registry. If both ever register a like-named metric, prometheus.Register
returns AlreadyRegisteredError and the MustNew* helpers panic at startup.

What changes were proposed in this pull request?

  • Construct the base executor scope once (executorScope := promutils.NewScope("executor")).
  • Give the webhook and plugin distinct sub-scopes derived from it:
    executorScope.NewSubScope("webhook") and executorScope.NewSubScope("plugin")
    (prefixes executor:webhook: and executor:plugin:).

Scoped to webhook + plugin per the issue. executor:storage and executor:catalog
already use distinct names, so they're collision-safe and left untouched. I'm happy to
fold those into the same base scope (emitted names unchanged) here or in a follow-up
if you'd prefer the file fully consistent.

How was this patch tested?

No new unit test, since this is setup wiring with no new logic, and the issue's
criteria only require the executor to start cleanly and existing tests to pass.
Verified locally with gofmt -l executor/setup.go, go build ./executor/..., and
go vet ./executor/... (all clean). CI exercises ./executor/....

Labels

  • changed

Setup process

N/A

Screenshots

N/A

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

N/A

Docs link

N/A

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 flyteorg#7456

Signed-off-by: davidlin20dev <davidlin20.dev@gmail.com>
@github-actions github-actions Bot added the flyte2 label Jun 5, 2026

@pingsutw pingsutw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@pingsutw pingsutw merged commit 91d1d9b into flyteorg:main Jun 17, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flyte2] Executor: dedupe the two promutils.NewScope("executor") constructions in setup.go

2 participants