protocols/request-response: Report successful request handling#1860
protocols/request-response: Report successful request handling#1860mxinden wants to merge 1 commit into
Conversation
When failing to respond to an inbound request, the `RequestResponse` `NetworkBehaviour` would emit an `InboundFailure` event. When succeeding to respond to an inbound request nothing would be emitted. With this commit the `RequestResponse` `NetworkBehaviour` emits a `InboundFinished` event for all inbound requests. The event contains a `result` describing whether handling the inbound request succeeded or failed. This can for example be used for statistics, counting the number of requests handled per second. Note: The `Throttled` `NetworkBehaviour` handles two types of incoming requests. (1) user level requests and (2) credit grants. In case handling the latter fails the `Throttled` `NetworkBehaviour` reports this failure. This can be unexpected as the user would receive a failure event for a request it never tried to handle. With this commit the confusion can be even larger as a user would receive a success event for a request it never handled.
650092c to
9414c47
Compare
Not quite. If the
Can this not already be calculated by correlating the number of calls to |
|
I just noticed that e.g. |
Yes, one could count the overall inbound requests and the failed inbound requests and derive the number of successful inbound requests. I would find having both an inbound failure and an inbound success event a better user experience, simplifying things on the user-side. As far as I can tell an additional inbound success event does not imply a performance penalty, but I might be wrong.
With your comments above in mind I will have to put more thoughts into this as well. At a first glance it seems not intuitive to return a |
|
With paritytech/substrate@707c1bd Substrate tracks the number of failed inbound requests as well as the time it took to build responses, similar to what was suggested above by @romanb. I think this is good enough at least for now. In case we need more visibility into this logic we can still revive this pull request. |
When failing to respond to an inbound request, the
RequestResponseNetworkBehaviourwould emit anInboundFailureevent. When succeedingto respond to an inbound request nothing would be emitted.
With this commit the
RequestResponseNetworkBehaviouremits aInboundFinishedevent for all inbound requests. The event contains aresultdescribing whether handling the inbound request succeeded orfailed. This can for example be used for statistics, counting the number
of requests handled per second.
Note: The
ThrottledNetworkBehaviourhandles two types of incomingrequests. (1) user level requests and (2) credit grants. In case
handling the latter fails the
ThrottledNetworkBehaviourreportsthis failure. This can be unexpected as the user would receive a failure
event for a request it never tried to handle. With this commit the
confusion can be even larger as a user would receive a success event for
a request it never handled.