Skip to content

fix(metrics): Prometheus metrics output#3640

Merged
philipsu522 merged 4 commits into
sei-protocol:mainfrom
m3diumrare:prom-metrics-fix
Jun 30, 2026
Merged

fix(metrics): Prometheus metrics output#3640
philipsu522 merged 4 commits into
sei-protocol:mainfrom
m3diumrare:prom-metrics-fix

Conversation

@m3diumrare

@m3diumrare m3diumrare commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

After the sei-chain to sei_chain prefix change in #3554, it surfaced that otel labels also had invalid Prometheus label characters ('.')

Tested on local Sei node, with this patch the Prometheus remote write endpoint no longer drops any metrics from the node.

Example before:

curl -si -H "Accept: application/openmetrics-text;version=1.0.0;escaping=allow-utf-8" http://127.0.0.1:26660/metrics | grep 'telemetry.sdk.language'
target_info{"service.name"="unknown_service:seid","telemetry.sdk.language"="go","telemetry.sdk.name"="opentelemetry","telemetry.sdk.version"="1.39.0"} 1

after:

 curl -si -H "Accept: application/openmetrics-text;version=1.0.0;escaping=allow-utf-8" http://127.0.0.1:26660/metrics | grep 'telemetry.sdk.language'
target_info{service_name="unknown_service:seid",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="1.39.0"} 1

@cursor

cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Observability-only exporter configuration; main risk is label/name changes for existing Prometheus queries or alerts.

Overview
Fixes Prometheus remote write dropping node metrics by translating OpenTelemetry metric/label names into Prometheus-safe form (dots and similar characters become underscores).

Both OTel→Prometheus setup paths now use WithTranslationStrategy(otlptranslator.UnderscoreEscapingWithSuffixes): SetupOtelPrometheus in sei-db and SetupOtelMetricsProvider in utils (still with the sei_chain namespace). github.com/prometheus/otlptranslator is added as a direct module dependency for that option.

Exported labels change shape—for example telemetry.sdk.language becomes telemetry_sdk_language—so scrapers and dashboards that assumed dotted OTel-style label names may need to match the new names.

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

@m3diumrare

Copy link
Copy Markdown
Contributor Author

@philipsu522 this would be great to get into 6.6 release if possible

@m3diumrare

Copy link
Copy Markdown
Contributor Author

Hi @Kbhat1 - is there a process for becoming a contributor? I'd like to get this reviewed and merged, and I'm concerned because my last PR fell by the wayside. I'm thinking the Contributor tag makes a difference in reviews here? Thanks

Also this is non-breaking for app hash, but I can't add that label.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 58.20%. Comparing base (89fcffe) to head (70d09f2).

Files with missing lines Patch % Lines
sei-db/common/metrics/setup.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3640      +/-   ##
==========================================
- Coverage   59.16%   58.20%   -0.96%     
==========================================
  Files        2263     2179      -84     
  Lines      187159   177514    -9645     
==========================================
- Hits       110724   103330    -7394     
+ Misses      66484    65028    -1456     
+ Partials     9951     9156     -795     
Flag Coverage Δ
sei-chain-pr 35.84% <80.00%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

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

Files with missing lines Coverage Δ
utils/metrics/metrics_util.go 88.55% <100.00%> (+0.17%) ⬆️
sei-db/common/metrics/setup.go 0.00% <0.00%> (ø)

... and 84 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.

@masih masih requested a review from sei-will June 30, 2026 15:41
@philipsu522 philipsu522 enabled auto-merge June 30, 2026 16:04
@philipsu522 philipsu522 disabled auto-merge June 30, 2026 16:32
@philipsu522 philipsu522 merged commit 2378fca into sei-protocol:main Jun 30, 2026
35 of 40 checks passed
@philipsu522 philipsu522 added the backport release/v6.6 Backport to release v6.6 label Jun 30, 2026
@philipsu522

Copy link
Copy Markdown
Contributor

/backport

@seidroid

seidroid Bot commented Jun 30, 2026

Copy link
Copy Markdown

Successfully created backport PR for release/v6.6:

philipsu522 added a commit that referenced this pull request Jun 30, 2026
Backport of #3640 to `release/v6.6`.

Co-authored-by: m3diumrare <127280934+m3diumrare@users.noreply.github.com>
Co-authored-by: Philip Su <philip.su.522@gmail.com>
yzang2019 added a commit that referenced this pull request Jun 30, 2026
* main:
  feat(seid): ConfigManager selection seam (PLT-775 PR1) (#3671)
  fix(evmrpc): limit listener max open connections, configurable via max_open_connections (PLT-704) (#3637)
  LittDB: Keymap threading improvements (#3645)
  integrate hashlogger (#3647)
  fix(metrics): Prometheus metrics output (#3640)
  [codex] Harden multiversion iterator validation (#3656)
  feat(consensus): mock_chain_validation replay build + memIAVL state-sync restore fixes (#3663)
  chore: replace OLD red SeiLogo banner in README with new 2026 Sei lockup (#3670)
  Require absolute path for evmone lib (#3668)
  fix(evmrpc): apply getLogs maxLog cap during merge instead of after (PLT-687) (#3666)
  feat(evmrpc): pre-decode request size admission control (PLT-295) (#3648)
  Make autobahn block production check wait for progress (#3667)
  fix(sei-tendermint): prevent readRoutine goroutine leak on /websocket when writeChan is full (PLT-707) (#3664)
  Per-block littidx flush + single shard (gated on #3645) (#3660)
  fix(evmrpc): bound debug_traceStateAccess memory and add trace admission control (PLT-360) (#3653)
  [codex] bump go-ethereum to v1.15.7-sei-17 (#3657)
  Upodate checkout GHA step across all workflows (#3659)
  Add GoReleaser release pipeline for static seid binaries (#3425)
  Parallelize littidx eth_getLogs across blocks (#3652)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants