rpc: report psrpc request delivery, expiry and claim outcomes - #1687
Open
u9g wants to merge 3 commits into
Open
Conversation
|
u9g
force-pushed
the
r1-psrpc-request-observer
branch
2 times, most recently
from
July 29, 2026 16:04
63f1e75 to
f48303a
Compare
u9g
marked this pull request as ready for review
July 29, 2026 17:15
PSRPCMetricsObserver implements psrpc.RequestObserver, installed via psrpc.WithServerObserver inside WithServerObservability. Reports the three server-side lifecycle events the interceptor chain cannot see, because in each case the handler is never invoked: a request read off the bus, a request dropped past its expiry, and settlement of the claim handshake.
u9g
force-pushed
the
r1-psrpc-request-observer
branch
from
July 29, 2026 17:21
f48303a to
661e964
Compare
The six middleware.MetricsObserver methods had no coverage. Extend the gather helper to filter by service and read gauges, so tests in this package stay independent of each other and of registry ordering.
paulwe
reviewed
Jul 29, 2026
Comment on lines
+297
to
+298
| logger.Warnw("psrpc request dropped: expired before dispatch", nil, | ||
| "service", info.Service, "method", info.Method, "lateBy", lateBy) |
Contributor
There was a problem hiding this comment.
the metric captures most of the same information - let's skip logging here.
| m.claimTotal.WithLabelValues(info.Service, info.Method, outcome.String()).Inc() | ||
| m.claimWaitTime.WithLabelValues(info.Service, info.Method, outcome.String()).Observe(float64(wait.Milliseconds())) | ||
|
|
||
| if outcome == psrpc.ClaimTimedOut { |
|
|
||
| func (o PSRPCMetricsObserver) OnClaim(info psrpc.RPCInfo, outcome psrpc.ClaimOutcome, wait time.Duration) { | ||
| m := metrics.Load() | ||
| m.claimTotal.WithLabelValues(info.Service, info.Method, outcome.String()).Inc() |
Contributor
There was a problem hiding this comment.
the histogram will have a _count already
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
psrpc has three server-side lifecycle events the interceptor chain can't see, because the handler is never invoked: a request read off the bus, one dropped past its expiry, and settlement of the claim handshake. The last is why a caller's
ErrNoResponseleaves no record on either side today — "never arrived" and "a server bid too late" look identical.PSRPCMetricsObserverimplementspsrpc.RequestObserver(livekit/psrpc#118, released as v0.7.3), installed viapsrpc.WithServerObserverinWithServerObservability, so services already using that pick it up unchanged:timed_outclaims and pre-dispatch expiry also log at warn.lost_to_peeris expected on broadcast RPCs; on a queue RPC it means two members got the same request.