[ 
https://issues.apache.org/jira/browse/AVRO-578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880399#action_12880399
 ] 

Patrick Wendell commented on AVRO-578:
--------------------------------------

Okay I think some re-factoring may need to be done to the RPCPugin module. The 
problem is that RPCContext's are confusingly used to pass information in both 
directions (eg requestor --> plugin and plugin --> requestor). Here is an 
example:

Reponder wants to generate a response, it needs to:

* Call plugin.serverSendResponse(context) to *get* the meta-data to encode in 
this response (from plugin)
* Generate encoded payload given the meta-data
* Call plugin.serverSendResponse(context) to *give* the response payload to the 
plugin

Obviously this cannot happen with only one call of serverSendResponse(context).

Not sure what the best way to change this is that will be extensible and useful 
to future plugin writers. One way would be to add add two calls in each place, 
one which interacts with plugin pre-encoding payload and the other after. That 
feels ugly to me... thoughts?

> Add RPC Payload to RPCContext class
> -----------------------------------
>
>                 Key: AVRO-578
>                 URL: https://issues.apache.org/jira/browse/AVRO-578
>             Project: Avro
>          Issue Type: Sub-task
>          Components: java
>            Reporter: Patrick Wendell
>            Assignee: Patrick Wendell
>         Attachments: AVRO-578.patch, AVRO-578.patch.v2
>
>
> For stats/monitoring it is helpful to see how many bytes are encoded for a 
> given RPC call. Right now Encoder's don't track how many payload bytes are 
> actually written out when encoding is done.
> Ideally this bytesWritten() would be in Encoder interface, however not sure 
> JSON plugin can track the number of characters actually written, so 
> alternatively just could be added to BinaryEncoder, and stats plugin will 
> only provide payload sizes when that encoder is used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to