Skip to content

feat(metrics): migrate sei-cosmos module packages to OpenTelemetry (PLT-414)#3512

Merged
amir-deris merged 4 commits into
mainfrom
amir/plt-413-migrate-more-packages-to-otel
May 29, 2026
Merged

feat(metrics): migrate sei-cosmos module packages to OpenTelemetry (PLT-414)#3512
amir-deris merged 4 commits into
mainfrom
amir/plt-413-migrate-more-packages-to-otel

Conversation

@amir-deris
Copy link
Copy Markdown
Contributor

@amir-deris amir-deris commented May 27, 2026

Summary

Migrates the following sei-cosmos packages from legacy telemetry/go-metrics to OpenTelemetry, using the dual-emit pattern (OTel instrument recorded first, old call retained with TODO(PLT-414) for removal once verified):

  • types/modulemodule_total_mid_block_duration, module_mid_block_duration (per-module label)
  • x/evidencebegin_blocker_duration
  • x/capabilitybegin_blocker_duration
  • x/crisisend_blocker_duration, init_genesis_unmarshal_duration
  • x/distributionbegin_blocker_duration
  • x/govend_blocker_duration
  • x/slashingbegin_blocker_duration; keeper: validator_slashed (with type + validator attributes)
  • x/stakingbegin_blocker_duration, end_blocker_duration

Each package gets a new metrics.go defining its OTel meter and instruments, following the pattern established in x/upgrade (PLT-353).

@cursor
Copy link
Copy Markdown

cursor Bot commented May 27, 2026

PR Summary

Low Risk
Observability-only changes with no consensus or state-machine logic altered; legacy metrics remain until verification.

Overview
This PR extends the PLT-414 OpenTelemetry migration across sei-cosmos module packages, using the same dual-emit pattern as x/upgrade (PLT-353): record OTel first, keep legacy telemetry calls behind TODO(PLT-414) until dashboards are validated.

New metrics.go files define package-scoped OTel meters and instruments—mostly second-based histograms with shared fine-grained bucket boundaries—for begin/end blocker timing in capability, crisis, distribution, evidence, gov, slashing, and staking, plus crisis InitGenesis unmarshal duration. types/module adds module_total_mid_block_duration and per-module module_mid_block_duration, with module attributes precomputed in SetOrderMidBlockers to avoid per-block allocations in MidBlock.

Slashing keeper adds an OTel validator_slashed counter (with type and validator labels) on double-sign and downtime slash paths. Staking keeper renames existing OTel instrument names to a staking_keeper_* prefix for clearer namespacing.

Reviewed by Cursor Bugbot for commit 1e237ac. Bugbot is set up for automated code reviews on this repo. Configure here.

@amir-deris amir-deris changed the title Added otel to more sei-cosmos modules feat(metrics): migrate sei-cosmos module packages to OpenTelemetry (PLT-414) May 27, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 29, 2026, 5:56 PM

@amir-deris amir-deris requested review from bdchatham and masih May 27, 2026 20:49
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 79.77528% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.17%. Comparing base (c4e1a2a) to head (1e237ac).

Files with missing lines Patch % Lines
sei-cosmos/types/module/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/capability/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/crisis/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/distribution/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/evidence/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/gov/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/slashing/keeper/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/slashing/metrics.go 50.00% 1 Missing and 1 partial ⚠️
sei-cosmos/x/staking/metrics.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3512      +/-   ##
==========================================
- Coverage   59.05%   58.17%   -0.89%     
==========================================
  Files        2205     2138      -67     
  Lines      182317   173502    -8815     
==========================================
- Hits       107672   100939    -6733     
+ Misses      64945    63587    -1358     
+ Partials     9700     8976     -724     
Flag Coverage Δ
sei-chain-pr 73.46% <79.77%> (?)
sei-db 70.41% <ø> (-0.22%) ⬇️
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-cosmos/types/module/module.go 60.33% <100.00%> (+1.56%) ⬆️
sei-cosmos/x/capability/abci.go 100.00% <100.00%> (ø)
sei-cosmos/x/crisis/abci.go 100.00% <100.00%> (ø)
sei-cosmos/x/crisis/module.go 68.85% <100.00%> (+0.51%) ⬆️
sei-cosmos/x/distribution/abci.go 100.00% <100.00%> (ø)
sei-cosmos/x/evidence/abci.go 46.15% <100.00%> (+23.93%) ⬆️
sei-cosmos/x/gov/abci.go 94.93% <100.00%> (+0.27%) ⬆️
sei-cosmos/x/slashing/abci.go 93.75% <100.00%> (+0.89%) ⬆️
sei-cosmos/x/slashing/keeper/infractions.go 96.39% <100.00%> (+0.03%) ⬆️
sei-cosmos/x/slashing/keeper/keeper.go 85.41% <100.00%> (+0.31%) ⬆️
... and 11 more

... and 112 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread sei-cosmos/x/capability/metrics.go
Copy link
Copy Markdown
Contributor

@bdchatham bdchatham left a comment

Choose a reason for hiding this comment

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

Two focused follow-ups from a cross-review pass. (Both non-blocking on their own — the larger naming-collision discussion on the per-package begin_blocker_duration / end_blocker_duration instruments is separate.)

Comment thread sei-cosmos/x/slashing/keeper/metrics.go
Comment thread sei-cosmos/types/module/module.go Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 97bc34d. Configure here.

Comment thread sei-cosmos/x/slashing/keeper/metrics.go
@amir-deris amir-deris added this pull request to the merge queue May 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 29, 2026
@amir-deris amir-deris added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit 3d3df7e May 29, 2026
54 of 55 checks passed
@amir-deris amir-deris deleted the amir/plt-413-migrate-more-packages-to-otel branch May 29, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants