Skip to content

feat(volo-thrift): record RPC transport fallback in the context - #679

Open
Joshuahoky wants to merge 3 commits into
mainfrom
feat/thrift-transport-fallback
Open

Joshuahoky wants to merge 3 commits into
mainfrom
feat/thrift-transport-fallback

Conversation

@Joshuahoky

@Joshuahoky Joshuahoky commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

shmipc has an in-session fallback: when a stream cannot get a shared-memory buffer it flips into a sticky fallback state and sends the payload over the session's UDS/TCP socket. The RPC still targets a shmipc address, so metrics layers that derive their transport tag from the address keep reporting shmipc even though the transport used was UDS.

Solution

  • Added volo::net::shmipc::ShmipcHelper::fallback_state() to expose the stream's flag
  • Added volo_thrift::transport::ShmipcPayloadFallback, a shmipc-only context market into the context extension written by the pingpong transports. It is only inserted when the stream carried the request or response over the session socket instead of shared memory

Consumers can then read cx.extensions().contains::<ShmipcPayloadFallback>().

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.37%. Comparing base (35e9130) to head (26d1cc4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #679   +/-   ##
=======================================
  Coverage   63.36%   63.37%           
=======================================
  Files         167      167           
  Lines       22940    22941    +1     
=======================================
+ Hits        14537    14538    +1     
  Misses       8403     8403           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

) -> Result<Self::Response, Self::Error> {
let oneway = cx.message_type == TMessageType::OneWay;
// A retried context must not report the previous attempt's fallback state.
cx.extensions.remove::<TransportFallback>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

需要加 #[cfg(feature = "shmipc")] 吗

@Joshuahoky
Joshuahoky force-pushed the feat/thrift-transport-fallback branch from b7fb9f1 to ed13b02 Compare October 29, 2026 12:54
@Joshuahoky
Joshuahoky force-pushed the feat/thrift-transport-fallback branch from ed13b02 to af72093 Compare November 6, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants