Skip to content

config: add [Metering].CapabilityUsageEnabled gate for workflow usage MeterRecords (CRE-6778) - #23857

Closed
DylanTinianov wants to merge 1 commit into
developfrom
CRE-6778-capability-usage-flag
Closed

DylanTinianov wants to merge 1 commit into
developfrom
CRE-6778-capability-usage-flag

Conversation

@DylanTinianov

@DylanTinianov DylanTinianov commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Part of capability-centric, eventually consistent workflow billing (CRE-6778). Config only; nothing emits yet.

What

New node setting, default false:

[Metering]
CapabilityUsageEnabled = false

It is the single switch for every per-capability usage MeterRecord emission point that follows (compute duration in the v2 engine, gas in the EVM/Solana write capabilities). Off means those emitters are never constructed and every emission site is a nil no-op. Node TOML is per DON, so this is the per-DON rollout gate the design doc asks for, and it can be turned off again without redeploying emitters.

Independent of MeterRecordsEnabled, which gates durable resource metering (active workflow specs) and must not be coupled to this rollout.

Plumbing mirrors MeterSnapshotsEnabled: toml.Metering, config.Metering interface, meteringConfig accessor, core.toml docs + regenerated docs/CONFIG.md, config fixtures, and plugins/loop_registry.go passes it to LOOP plugins as CL_CAPABILITY_USAGE_ENABLED (needs chainlink-common EnvConfig.CapabilityUsageEnabled). Local CRE node config (system-tests/lib/cre/don/config) turns it on.

Depends on

chainlink-common: EnvConfig.CapabilityUsageEnabled (bumped here).

… MeterRecords

Per-capability workflow billing (CRE-6778) adds METER_ACTION_USAGE records for
compute duration and gas at every capability that bills a workflow execution.
This setting is the single switch for all of those emission points, default
false, so DONs can be moved to the new records one at a time and rolled back
without a redeploy of the emitters.

It is independent of MeterRecordsEnabled, which gates durable resource metering
(active workflow specs) and must not be coupled to this rollout. Passed to LOOP
capability plugins as CL_CAPABILITY_USAGE_ENABLED.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The generated docs/CONFIG.md remains stale and omits the new operator-facing setting.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Risk Rating: LOW — Adds a disabled-by-default configuration gate with focused plumbing and tests.

Introduces a per-DON capability-usage metering gate and forwards it to LOOP plugins.

Changes:

  • Adds CapabilityUsageEnabled across TOML, interfaces, defaults, fixtures, and tests.
  • Enables the gate for local CRE worker nodes.
  • Updates chainlink-common for the corresponding EnvConfig field.

Human review focus: Verify the chainlink-common LOOP environment contract and regenerated configuration documentation.

File Description
go.mod Updates chainlink-common.
go.sum Updates dependency checksums.
plugins/​loop_registry.go Passes the gate to LOOP plugins.
plugins/​loop_registry_test.go Tests LOOP propagation.
core/​config/​metering_config.go Extends the metering interface.
core/​config/​toml/​types.go Adds the TOML field and merge behavior.
core/​config/​docs/​core.toml Defines the documented default.
core/​services/​chainlink/​config_metering.go Exposes the resolved value.
core/​services/​chainlink/​config_metering_test.go Tests default and explicit values.
core/​services/​chainlink/​config_test.go Covers configuration marshaling.
core/​services/​chainlink/​testdata/​config-full.toml Adds the enabled fixture value.
core/​services/​chainlink/​testdata/​config-empty-effective.toml Adds the default fixture value.
core/​services/​chainlink/​testdata/​config-multi-chain-effective.toml Adds the default fixture value.
core/​web/​resolver/​testdata/​config-full.toml Updates resolver fixture output.
core/​web/​resolver/​testdata/​config-empty-effective.toml Updates resolver default output.
core/​web/​resolver/​testdata/​config-multi-chain-effective.toml Updates resolver multichain output.
system-tests/​lib/​cre/​don/​config/​config.go Enables usage metering locally.
system-tests/​lib/​cre/​don/​config/​config_test.go Tests local enablement.
system-tests/​lib/​go.mod Updates chainlink-common.
system-tests/​lib/​go.sum Updates checksums.
system-tests/​tests/​go.mod Updates chainlink-common.
system-tests/​tests/​go.sum Updates checksums.
system-tests/​tests/​canaries_sentinels/​proof-of-reserve/​cron-based/​go.mod Updates dependencies and Go version.
system-tests/​tests/​canaries_sentinels/​proof-of-reserve/​cron-based/​go.sum Updates checksums.
integration-tests/​go.mod Updates chainlink-common.
integration-tests/​go.sum Updates checksums.
integration-tests/​load/​go.mod Updates chainlink-common.
integration-tests/​load/​go.sum Updates checksums.
deployment/​go.mod Updates chainlink-common.
deployment/​go.sum Updates checksums.
core/​scripts/​go.mod Updates chainlink-common.
core/​scripts/​go.sum Updates checksums.
devenv/​go.mod Updates and tidies dependencies.
devenv/​go.sum Updates checksums.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +970 to +973
# CapabilityUsageEnabled enables per-capability workflow usage MeterRecords (compute duration, gas per chain write)
# for eventually consistent billing. Off by default; enable per DON once the billing service accepts capability usage records.
# Independent of MeterRecordsEnabled.
CapabilityUsageEnabled = false # Default
@DylanTinianov

Copy link
Copy Markdown
Contributor Author

Closing: per review on chainlink-common #2428, capability usage records share the existing [Metering].MeterRecordsEnabled gate; no separate flag. #23858 now bases on develop.

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.

2 participants