Skip to content

chore: improve OTEL semantics#680

Closed
jeluard wants to merge 1 commit intomainfrom
jeluard/otel-lean
Closed

chore: improve OTEL semantics#680
jeluard wants to merge 1 commit intomainfrom
jeluard/otel-lean

Conversation

@jeluard
Copy link
Contributor

@jeluard jeluard commented Feb 21, 2026

OTEL main focus is to give insights to internal block processing. This PR removes some span creations outside of this flow that creates thousands of spans per second, making it impractical and costly to follow all traces.

Summary by CodeRabbit

  • Refactor
    • Removed internal tracing/observability instrumentation across networking, multiplexing, and polling paths to simplify execution and reduce observational overhead while preserving behavior and public APIs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 92bc00ef-6662-4cd8-b041-2acb50610a9f

📥 Commits

Reviewing files that changed from the base of the PR and between d0122bd and fb1c6f3.

📒 Files selected for processing (3)
  • crates/amaru-network/src/connection.rs
  • crates/amaru-protocols/src/mux.rs
  • crates/pure-stage/src/tokio.rs
💤 Files with no reviewable changes (1)
  • crates/amaru-protocols/src/mux.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/pure-stage/src/tokio.rs

Walkthrough

Removed tracing/instrumentation spans from connection send/recv, Muxer methods, and the stage.poll span; preserved original control flow and public signatures. Added an explicit drop(poll) after polling in the async runtime.

Changes

Cohort / File(s) Summary
Network connection
crates/amaru-network/src/connection.rs
Removed tracing spans and length computation wrappers around send and recv; async blocks are now boxed directly while keeping read/write and EOF handling intact.
Protocol muxer
crates/amaru-protocols/src/mux.rs
Stripped tracing/instrumentation attributes from Muxer methods (outgoing, next_segment, received, want_next) without changing signatures or core logic.
Async runtime / polling
crates/pure-stage/src/tokio.rs
Removed the span around stage.poll and added an explicit drop(poll) after polling; control flow unchanged (Ready -> return Some, Pending -> continue).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • abailly

Poem

Strip the spans and let the logs breathe free,
Polls drop tidy like a seaside melody.
Async hums on, lighter as a breeze—
Clean code strolls by, no noisy unease. 🎮🍀

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: improve OTEL semantics' is vague and doesn't clearly convey what the PR actually does—removing extraneous span instrumentation to reduce tracing overhead. Consider a more descriptive title like 'chore: remove extraneous tracing spans to reduce OTEL overhead' that better reflects the actual changes and their intent.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jeluard/otel-lean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jeluard jeluard force-pushed the jeluard/otel-lean branch 2 times, most recently from 44461e4 to c22f853 Compare February 21, 2026 08:12
@jeluard jeluard marked this pull request as ready for review February 21, 2026 08:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces OpenTelemetry verbosity by removing trace-level span instrumentation from high-frequency operations that were creating thousands of spans per second. The focus shifts OTEL tracing to concentrate on internal block processing flows, making traces more practical and cost-effective.

Changes:

  • Removed trace span from stage polling loop in pure-stage executor
  • Removed trace-level instrumentation from 4 high-frequency multiplexer methods
  • Removed trace spans from network send/recv operations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/pure-stage/src/tokio.rs Removed trace span from high-frequency stage poll operation in interpreter loop
crates/amaru-protocols/src/mux.rs Removed trace-level instrument attributes from 4 high-frequency network multiplexer methods (outgoing, next_segment, received, want_next) while retaining debug-level instrumentation for less frequent operations
crates/amaru-network/src/connection.rs Removed trace spans from high-frequency send/recv connection operations while preserving instrumentation on less frequent operations like close

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
crates/amaru-network/src/connection.rs 95.34% <100.00%> (-0.11%) ⬇️
crates/amaru-protocols/src/mux.rs 95.97% <ø> (+0.62%) ⬆️
crates/pure-stage/src/tokio.rs 89.06% <100.00%> (-0.06%) ⬇️

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/pure-stage/src/tokio.rs (1)

417-421: Explicit drop(poll) is safe and readable, though technically redundant.

Reaching line 421 guarantees poll == Poll::Pending — a unit variant carrying no data — so the drop is a runtime no-op. That said, it's a bonzer signal: it makes the intent clear that poll's lifetime deliberately ends before the effect.lock().take() dance below. No concerns here, just a heads-up in case a future reader wonders why it's there.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/pure-stage/src/tokio.rs` around lines 417 - 421, The explicit
drop(poll) is technically redundant because Poll::Pending is unit, but please
keep it and add a short comment clarifying intent so future readers don't
wonder; locate the poll created by stage.as_mut().poll(&mut
Context::from_waker(Waker::noop())) and add a one-line comment immediately
before or after drop(poll) explaining that the drop intentionally ends poll's
borrow/lifetime before the subsequent effect.lock().take() work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/pure-stage/src/tokio.rs`:
- Around line 417-421: The explicit drop(poll) is technically redundant because
Poll::Pending is unit, but please keep it and add a short comment clarifying
intent so future readers don't wonder; locate the poll created by
stage.as_mut().poll(&mut Context::from_waker(Waker::noop())) and add a one-line
comment immediately before or after drop(poll) explaining that the drop
intentionally ends poll's borrow/lifetime before the subsequent
effect.lock().take() work.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c22f853 and d0122bd.

📒 Files selected for processing (3)
  • crates/amaru-network/src/connection.rs
  • crates/amaru-protocols/src/mux.rs
  • crates/pure-stage/src/tokio.rs
💤 Files with no reviewable changes (1)
  • crates/amaru-protocols/src/mux.rs

@jeluard jeluard changed the title chore: reduce OTEL verbosity chore: improve OTEL semantics Feb 27, 2026
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
@jeluard jeluard force-pushed the jeluard/otel-lean branch from d0122bd to fb1c6f3 Compare March 6, 2026 18:36
@jeluard
Copy link
Contributor Author

jeluard commented Mar 20, 2026

Superseded by #723

@jeluard jeluard closed this Mar 20, 2026
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