Skip to content

Refine logging to avoid printing expensive objects on hot path#3066

Merged
masih merged 5 commits intomainfrom
masih/fix-expensive-logged-objs
Mar 13, 2026
Merged

Refine logging to avoid printing expensive objects on hot path#3066
masih merged 5 commits intomainfrom
masih/fix-expensive-logged-objs

Conversation

@masih
Copy link
Collaborator

@masih masih commented Mar 13, 2026

Fix logging of objects to: 1) avoid printing expensive encodings, and 2) use hex encoded string for bytes.

Fix logging of objects to: 1) avoid printing expensive encodings, and 2)
use hex encoded string for bytes.
@github-actions
Copy link

github-actions bot commented Mar 13, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 13, 2026, 1:19 PM

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 55.55556% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.59%. Comparing base (c6b1a49) to head (57b8acf).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/mempool/mempool.go 50.00% 4 Missing ⚠️
sei-tendermint/rpc/jsonrpc/server/ws_handler.go 0.00% 2 Missing ⚠️
sei-tendermint/test/e2e/app/app.go 0.00% 2 Missing ⚠️
sei-tendermint/internal/evidence/pool.go 75.00% 1 Missing ⚠️
sei-tendermint/internal/mempool/reactor.go 0.00% 1 Missing ⚠️
sei-tendermint/internal/state/execution.go 0.00% 1 Missing ⚠️
sei-tendermint/rpc/jsonrpc/client/ws_client.go 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3066   +/-   ##
=======================================
  Coverage   58.58%   58.59%           
=======================================
  Files        2080     2080           
  Lines      171656   171659    +3     
=======================================
+ Hits       100567   100580   +13     
+ Misses      62166    62159    -7     
+ Partials     8923     8920    -3     
Flag Coverage Δ
sei-chain-pr 71.85% <55.55%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-tendermint/internal/consensus/state.go 74.70% <100.00%> (+0.61%) ⬆️
sei-tendermint/types/mempool.go 60.00% <100.00%> (+1.86%) ⬆️
sei-tendermint/internal/evidence/pool.go 69.27% <75.00%> (ø)
sei-tendermint/internal/mempool/reactor.go 72.10% <0.00%> (ø)
sei-tendermint/internal/state/execution.go 81.42% <0.00%> (ø)
sei-tendermint/rpc/jsonrpc/client/ws_client.go 74.66% <75.00%> (+0.90%) ⬆️
sei-tendermint/rpc/jsonrpc/server/ws_handler.go 56.35% <0.00%> (ø)
sei-tendermint/test/e2e/app/app.go 0.00% <0.00%> (ø)
sei-tendermint/internal/mempool/mempool.go 72.79% <50.00%> (ø)
🚀 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 review from mojtaba-esk and sei-will March 13, 2026 11:39
logger.Info("sent a request", "method", request.Method, "id", request.ID())
// c.mtx.Lock()
// c.sentIDs[request.ID.(types.JSONRPCIntID)] = true
// c.mtx.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit]: unrelated to the PR, but im curious why we keep commented code in the codebase here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great question. This one goes back a few years. We should separately review cases like this

_, _, err := parseTx(tx)
if err != nil {
logger.Error("malformed transaction in ProcessProposal", "tx", tx, "err", err)
logger.Error("malformed transaction in ProcessProposal", "len-bytes", len(tx), "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit]: wouldn't this be useful to have the full tx in a debug log as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could but for malformed proposals off the wire that could be large at Error level would come with security concerns.

An alternative approach is to log the proposal at debug level disabled by default. I will add that 🙌

@masih masih enabled auto-merge March 13, 2026 13:19
@masih masih added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit 837ba92 Mar 13, 2026
38 checks passed
@masih masih deleted the masih/fix-expensive-logged-objs branch March 13, 2026 13:47
yzang2019 added a commit that referenced this pull request Mar 16, 2026
* main:
  fix(giga): match v2 correctness checks (#3071)
  Added clone method to canned random (#3076)
  Helper files for the flatKV cache implementation (#3072)
  fix: restore PRs inadvertently reverted by #3039 squash-merge (#3070)
  Refine logging to avoid printing expensive objects on hot path (#3066)
  Fix flaky tendermint syncer test (#3065)
  Add runtime log level control via gRPC admin service (#3062)
  chore: dcoument run RPC suite on legacy vs giga (#3041)
  chore: self-contained revert tests, contract reorg, and failure analysis (#3033)
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