-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StatsHandler
Order Guarantees
#7787
Comments
Similar question around the order of |
Hey @davinci26, this assumption holds because even though there is nothing to enforce the order, stats.Begin is triggered as soon as an RPC attempt begins, and logically, there shouldn't be anything before it, as noted here: Similarly, stats.End is called when the RPC concludes, so ideally, there should be nothing after it as noted here : That said, this applies to a single RPC. If there is a stream of concurrent RPCs, it’s possible to see a stats.InHeader from another RPC before the stats.Begin of a different RPC. If that's not the case, it would likely indicate a bug. If you encounter such a scenario, providing repro steps would be very helpful. |
|
Yeah this code https://gist.github.com/davinci26/ae394645582488c1c44b5dcb96d52f3a it has: The repro is based on the example in the repro so it should be pretty simple to run with
In that case |
@davinci26 Thanks for raising this question! The current server-side implementation for server does indeed call The server-side stats events follow this order:
You're right that this ordering should be better documented. Here is what we would like to have:
For now, you can rely on InHeader coming before Begin for server-side stats handlers. |
Hey folk,
I am wondering if there are any guarantees around the order of operations in Handler.HandleRPC
In particular can I assume that
HandleRPC
will always be called with:stats.Begin
as the first one alwaysstats.End
as the last one alwaysThe reason I am asking is that I have case where
stats.InHeader
seems to be coming beforestats.Begin
and I wanted to see if this is by-design or a bug.The text was updated successfully, but these errors were encountered: