Skip to content

feat(beholder): reduce PerWorkflow histogram buckets 16→8#2226

Draft
pkcll wants to merge 6 commits into
beholder-otel-limit-metric-cardinalityfrom
beholder-perworkflow-histogram-buckets
Draft

feat(beholder): reduce PerWorkflow histogram buckets 16→8#2226
pkcll wants to merge 6 commits into
beholder-otel-limit-metric-cardinalityfrom
beholder-perworkflow-histogram-buckets

Conversation

@pkcll

@pkcll pkcll commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2225. Reduces CRE PerWorkflow limit histograms from the OTel SDK default (15 boundaries / 16 buckets) to 7 boundaries / 8 buckets via Beholder metricviews.DefaultViews().

Targets *.PerWorkflow.* histograms from pkg/settings/limits (bound, time, resource, range, queue, rate). Chainlink does not register caller views for these names, so the Beholder defaults apply.

Unit class Boundaries (7 → 8 buckets)
By (bytes) 0, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8
s (seconds) 0, 1, 10, 60, 300, 900, 3600
counts (default) 0, 1, 10, 100, 1e3, 1e4, 1e5

Motivation

Cardinality report for linkforest-cre-don-workflow (~226k series): PerWorkflow + platform_engine histogram families dominate. Halving bucket count on PerWorkflow families cuts ~60k series on that node profile (590 workflows × ~30 histogram metrics × 8 vs 16 buckets).

Alert impact

  • None. Searched ~/repos/alerts — no rules reference *_PerWorkflow_*_bucket or histogram_quantile on PerWorkflow histograms.

Dashboard impact

Dashboard Impact Notes
Limits-Workflow (13 zones) Low 88 panels/dashboard use histogram_quantile(1, …) on 44 PerWorkflow *_bucket metrics (max usage / usage-vs-limit %). No p95/p99.
Workflows-Executions (13 zones) Low Same quantile(1) pattern in limit overview panel.
gate_* / queue_* / resource_* PerWorkflow panels None Gauges/counters, not histogram buckets.
Workflows-Engine / platform_engine_* None Out of scope; uses chainlink caller views.

Staging validation: spot-check Limits-Workflow usage-vs-limit panels, especially byte limits near 100 MiB (top bucket boundary 1e8 vs limit 104,857,600 B).

Merge order

Merge #2225 first, then this PR.

Test plan

  • go test ./pkg/beholder/metricviews/...
  • Validate Limits-Workflow panels on staging after chainlink-common bump
  • Compare count({csa_public_key="…"}) on a high-workflow-count node before/after

pkcll and others added 4 commits July 6, 2026 23:15
AsCmdEnv always emitted CL_TELEMETRY_METRIC_CARDINALITY_LIMIT, so
callers that don't set the field explicitly forced 0 and disabled the
10000 default in EnvConfig.parse. Only emit the env var when non-zero.

mergeMetricViews prepended the default cardinality-limiting views
(including a catch-all "*" view) before caller-supplied MetricViews.
Since the OTel SDK dedupes views by stream identity and keeps the
first match, this silently shadowed caller customizations such as
histogram buckets set via WithOtelViews. Append defaults after caller
views instead.
Correct the metricviews package/DefaultViews and mergeMetricViews comments
to describe the actual OTel SDK behavior: an instrument may match multiple
views, and dedup is by resolved stream identity (name/description/unit/kind)
keeping the first in registration order — not "first matching view for the
instrument". Explains why caller views precede defaults and why attribute
filters do not compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📊 API Diff Results

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

View full report

Add DefaultViews aggregation overrides for *.PerWorkflow.* histograms
emitted by pkg/settings/limits. Uses 7 explicit boundaries (8 Prometheus
buckets) per unit class: bytes (By), seconds (s), and dimensionless counts.

CRE Limits-Workflow dashboards query histogram_quantile(1, ...) on these
metrics, so coarser buckets preserve max usage vs limit panels while
halving le cardinality on the dominant series families.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkcll pkcll force-pushed the beholder-perworkflow-histogram-buckets branch from 2c01364 to 1f04f83 Compare July 7, 2026 04:10
@pkcll pkcll requested review from jmank88 and patrickhuie19 July 7, 2026 05:16
… views

The bucket-boundary views for *.PerWorkflow.* histograms claimed the OTel
stream identity ahead of the global deny-filter view, so the SDK's
first-match-wins dedup silently dropped the deny filter for those metrics.
Attach globalHighCardinalityDeny directly to each bucket-override Stream
mask so it travels with the aggregation override.

Also add a {gas}-unit-specific view: PerWorkflow gas limit histograms
(ChainWrite defaults up to 50_000_000) were falling into the unit-less
count-boundaries view (max 1e5), collapsing nearly all observations into
the +Inf bucket.
@pkcll pkcll force-pushed the beholder-otel-limit-metric-cardinality branch from 1203e1b to 8231c54 Compare July 7, 2026 20:42
Comment thread pkg/beholder/config.go

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.

what happens if this limit is exceeded?

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