Skip to content

ResourceManager Cardinality: drop resource_id from usage records - #2472

Merged
DylanTinianov merged 3 commits into
mainfrom
CRE-6779-utilization-gauge-cardinality
Oct 15, 2026
Merged

DylanTinianov merged 3 commits into
mainfrom
CRE-6779-utilization-gauge-cardinality

Conversation

@DylanTinianov

@DylanTinianov DylanTinianov commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

resource_manager_utilization no longer carries a resource_id label, for any record type. The id stays on the durable MeterRecord / MeterSnapshot events.

Why

Usage record resource ids are per execution (WorkflowUsageResourceID(workflowID, executionID)), so the gauge gained a new series for every execution on every node. That series set is unbounded and eventually makes the node's metric export payload too large for the collector to accept, at which point every metric from that process is dropped.

Dropping the label outright, rather than per record type, removes the option to reintroduce the cardinality later.

Testing

TestUtilizationGauge_NoResourceIDLabel reads the gauge through an OTel manual reader: usage, delta and snapshot records with distinct resource ids collapse to one series per resource_type with no resource_id, and the emitted records still carry every id.

🤖 Generated with Claude Code

…e records

Usage record resource ids are per-execution, so labeling the gauge with them
creates an unbounded series set per node. On CRE staging zone-a this grew by
thousands of series per hour until the OTLP export exceeded the collector's
16 MiB limit and every platform_engine_* metric was dropped. Snapshots keep
the label: their resource id is the workflow id, which is bounded.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DylanTinianov
DylanTinianov requested a review from a team as a code owner October 15, 2026 13:37
Copilot AI balanced review requested due to automatic review settings October 15, 2026 13:37
@github-actions

Copy link
Copy Markdown
Contributor

👋 DylanTinianov, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

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.

🟡 Changes recommended

Label removal also affects durable-resource deltas, incorrectly merging previously distinct resource series.

1 open finding
What changed in this PR

Reduces utilization metric cardinality by removing per-execution resource IDs from usage measurements while retaining snapshot IDs.

Changes:

  • Adds conditional resource_id labeling to the utilization gauge.
  • Adds tests for usage-series consolidation and snapshot labels.
File Description
pkg/​resourcemanager/​utilization_gauge_test.go Tests usage and snapshot labeling.
pkg/​resourcemanager/​resourcemanager.go Controls resource ID labels when recording utilization.

🧠 Review effort: Balanced


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

Comment thread pkg/resourcemanager/resourcemanager.go Outdated
@DylanTinianov DylanTinianov self-assigned this Oct 15, 2026
@DylanTinianov DylanTinianov changed the title resourcemanager: drop resource_id from the utilization gauge for usage records ResourceManager Cardinality: drop resource_id from usage records Oct 15, 2026
Only usage records have per-execution ids. Deltas address durable resources
and must share a series with the matching snapshot.

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

@github-actions github-actions Bot 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.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 19c347c Previous: b22d56c Ratio
BenchmarkKeystore_Sign/nop/out-of-process 57786 ns/op 28372 ns/op 2.04
BenchmarkKeystore_Sign/hex/out-of-process 57004 ns/op 26722 ns/op 2.13
BenchmarkKeystore_Sign/ed25519/out-of-process 95744 ns/op 47119 ns/op 2.03

This comment was automatically generated by workflow using github-action-benchmark.

Comment thread pkg/resourcemanager/resourcemanager.go Outdated
The id can be per-execution, so it stays on the durable MeterRecord and
MeterSnapshot events only. No caller option.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DylanTinianov
DylanTinianov added this pull request to the merge queue Oct 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 15, 2026
@DylanTinianov
DylanTinianov added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit f1f2b6d Oct 15, 2026
35 of 36 checks passed
@DylanTinianov
DylanTinianov deleted the CRE-6779-utilization-gauge-cardinality branch October 15, 2026 15:29
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