Skip to content

feat(metrics): migrate app/legacyabci, loadtest, utils/logging, wasmbinding to OpenTelemetry#3446

Open
amir-deris wants to merge 4 commits into
mainfrom
amir/plt-342-migrate-appLegacyAbci-loadTest-and-some-others-Otel
Open

feat(metrics): migrate app/legacyabci, loadtest, utils/logging, wasmbinding to OpenTelemetry#3446
amir-deris wants to merge 4 commits into
mainfrom
amir/plt-342-migrate-appLegacyAbci-loadTest-and-some-others-Otel

Conversation

@amir-deris
Copy link
Copy Markdown
Contributor

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

Adds OTel instrumentation to app/legacyabci, loadtest, utils/logging, and wasmbinding following the same pattern as PLT-329, PLT-330, and PLT-339 (#3439).

New instruments

app/legacyabci (meter legacyabci)

  • begin_blocker_duration — histogram, seconds, fine-grained buckets; dual-emit TODO(PLT-343)
  • ibc_begin_blocker_duration — histogram, seconds, fine-grained buckets; dual-emit TODO(PLT-343)
  • tx_duration — histogram, seconds, mode label (check/recheck/deliver); dual-emit TODO(PLT-343)

loadtest (meter loadtest)

  • produce — counter, msg_type label (replaces metrics.IncrProducerEventCount)
  • consume — counter, msg_type label (replaces metrics.IncrConsumerEventCount)
  • tps — gauge, msg_type label (replaces metrics.SetThroughputMetricByType)

utils/logging (meter utils_logging)

  • log_not_done_after — counter, label label (replaces metrics.IncrLogIfNotDoneAfter)

wasmbinding (meter wasmbinding)

  • wasm_query_association_error — counter, scenario + type labels (replaces metrics.IncrementErrorMetrics)
  • wasm_query_sdk_error — counter, scenario + codespace + code labels (new; fires for any structured SDK error that is not an association error)

Notes

  • loadtest and utils/logging (only used for tests) are direct replacement with no dual-emit — legacy calls removed entirely.
  • app/legacyabci uses dual-emit with TODO(PLT-343) comments pending dashboard verification.
  • utils/panic.MetricsPanicCallback was unused and removed as part of this cleanup.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 15, 2026

PR Summary

Medium Risk
Touches hot-path BeginBlock, CheckTx, and DeliverTx by replacing telemetry timing/throughput instrumentation with OTel histograms (with temporary dual-emission), so mistakes could affect performance or metric reporting but should not change consensus logic.

Overview
Migrates several internal metrics from the legacy telemetry/utils/metrics helpers to OpenTelemetry instruments.

app/legacyabci now records OTel histograms for total begin-block duration, IBC begin-block duration, and tx processing duration by mode (check/recheck/deliver), while temporarily dual-emitting the prior telemetry metrics for dashboard verification.

loadtest switches produced/consumed tx counts and per-message-type TPS reporting to OTel counters/gauge, utils/logging replaces the LogIfNotDoneAfter timeout counter with an OTel counter, and wasmbinding adds OTel counters for query error categories (association-missing and structured SDK errors) while keeping a temporary legacy error-metric emission. Also removes unused legacy metric helpers and the unused utils/panic.MetricsPanicCallback.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 15, 2026, 10:23 PM

@amir-deris amir-deris changed the title Added metrics for legacyabci, loadtest, utils and wasmbinding feat(metrics): migrate app/legacyabci, loadtest, utils/logging, wasmbinding to OpenTelemetry May 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 45.71429% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.30%. Comparing base (823a78d) to head (bc0a6eb).

Files with missing lines Patch % Lines
wasmbinding/metrics.go 25.00% 14 Missing and 1 partial ⚠️
app/legacyabci/check_tx.go 0.00% 11 Missing ⚠️
loadtest/metrics.go 0.00% 4 Missing ⚠️
app/legacyabci/metrics.go 50.00% 1 Missing and 1 partial ⚠️
loadtest/loadtest_client.go 0.00% 2 Missing ⚠️
utils/logging/metrics.go 50.00% 1 Missing and 1 partial ⚠️
loadtest/main.go 0.00% 1 Missing ⚠️
wasmbinding/queries.go 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3446   +/-   ##
=======================================
  Coverage   59.29%   59.30%           
=======================================
  Files        2125     2128    +3     
  Lines      175629   175634    +5     
=======================================
+ Hits       104144   104155   +11     
+ Misses      62404    62395    -9     
- Partials     9081     9084    +3     
Flag Coverage Δ
sei-chain-pr 22.98% <45.71%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
app/legacyabci/begin_block.go 100.00% <100.00%> (ø)
app/legacyabci/deliver_tx.go 96.05% <100.00%> (+0.21%) ⬆️
utils/logging/time.go 100.00% <100.00%> (ø)
utils/metrics/metrics_util.go 70.95% <ø> (+3.91%) ⬆️
utils/panic.go 78.57% <ø> (+37.83%) ⬆️
loadtest/main.go 0.00% <0.00%> (ø)
wasmbinding/queries.go 27.94% <50.00%> (-0.43%) ⬇️
app/legacyabci/metrics.go 50.00% <50.00%> (ø)
loadtest/loadtest_client.go 0.00% <0.00%> (ø)
utils/logging/metrics.go 50.00% <50.00%> (ø)
... and 3 more
🚀 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 wasmbinding/queries.go Outdated
Comment thread utils/metrics/metrics_util.go
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 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 9ccc1c6. Configure here.

Comment thread wasmbinding/metrics.go Outdated
@amir-deris amir-deris requested review from bdchatham and masih May 15, 2026 22:33
// Generate a message type first
messageType := c.getRandomMessageType(config.MessageTypes)
metrics.IncrProducerEventCount(messageType)
loadtestMetrics.produceCount.Add(context.Background(), 1, otelmetric.WithAttributes(attribute.String("msg_type", messageType)))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For loadtest, replaced the metrics as it is only for test and no need to emit dual metrics.

Comment thread utils/logging/time.go
// reraise panic in main goroutine
panic(err)
case <-time.After(after):
metrics.IncrLogIfNotDoneAfter(label)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This function LogIfNotDoneAfter is only used in tests, so no need for keeping the older metric.

// Metric Names:
//
// sei_log_not_done_after_counter
func IncrLogIfNotDoneAfter(label string) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed functions that were only used in tests.

Comment thread utils/panic.go
}
}

func MetricsPanicCallback(err any, ctx sdk.Context, key string) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unused function.

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.

1 participant