Skip to content

change UserMetricsLimiter to gate limitter#1964

Merged
jmank88 merged 1 commit intomainfrom
DF-23781-2
Apr 7, 2026
Merged

change UserMetricsLimiter to gate limitter#1964
jmank88 merged 1 commit intomainfrom
DF-23781-2

Conversation

@karen-stepanyan
Copy link
Copy Markdown
Contributor

@karen-stepanyan karen-stepanyan commented Apr 6, 2026

  • Replace EnableUserMetrics bool on ModuleConfig with EnableUserMetricsLimiter limits.GateLimiter, enabling overrides via CL_CRE_SETTINGS
  • Update emitMetric host function to call AllowErr(ctx) on the gate limiter instead of checking a static bool, making the gate context-aware

Why
The previous EnableUserMetrics bool field was never set by any caller (always defaulted to false), making user metrics permanently disabled with no way to enable them. The UserMetricEnabled setting in cresettings/defaults.toml and the GateLimiter in EngineLimiters existed but were disconnected from the actual WASM host gate check.

Core PR - smartcontractkit/chainlink#21868

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-common

⚠️ Breaking Changes (1)

pkg/workflows/wasm/host.ModuleConfig (1)
  • EnableUserMetrics — 🗑️ Removed

✅ Compatible Changes (1)

pkg/workflows/wasm/host.ModuleConfig (1)
  • EnableUserMetricsLimiter — ➕ Added

📄 View full apidiff report

@karen-stepanyan karen-stepanyan marked this pull request as ready for review April 6, 2026 13:26
@karen-stepanyan karen-stepanyan requested a review from a team as a code owner April 6, 2026 13:26
Copilot AI review requested due to automatic review settings April 6, 2026 13:26
Copy link
Copy Markdown
Contributor

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 updates the WASM host’s “user metrics enabled” gating from a static bool to a context-aware limits.GateLimiter, aligning the host-side emitMetric check with the existing limits/settings infrastructure and allowing runtime overrides via CRE settings.

Changes:

  • Replace ModuleConfig.EnableUserMetrics bool with ModuleConfig.EnableUserMetricsLimiter limits.GateLimiter.
  • Default EnableUserMetricsLimiter to a closed gate when unset to avoid nil usage.
  • Update emitMetric to call EnableUserMetricsLimiter.AllowErr(ctx) instead of checking a boolean; adjust tests accordingly.

Reviewed changes

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

File Description
pkg/workflows/wasm/host/module.go Replaces config flag with a GateLimiter and initializes a default limiter when nil.
pkg/workflows/wasm/host/execution.go Switches metric emission gating to AllowErr(ctx) on the configured gate limiter.
pkg/workflows/wasm/host/wasm_nodag_test.go Updates tests to use the new limiter-based config and relies on default-closed behavior when unset.

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

@karen-stepanyan karen-stepanyan requested a review from bolekk April 7, 2026 14:18
@jmank88 jmank88 requested a review from pavel-raykov April 7, 2026 14:49
@jmank88 jmank88 added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit 8115835 Apr 7, 2026
35 of 37 checks passed
@jmank88 jmank88 deleted the DF-23781-2 branch April 7, 2026 15:12
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.

4 participants