thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuxuan Wang (Jira)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-5164) Go middleware support
Date Mon, 27 Apr 2020 23:53:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-5164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17094027#comment-17094027
] 

Yuxuan Wang commented on THRIFT-5164:
-------------------------------------

So after I created this ticket, we also implemented a middleware framework on the client side,
and I think we can contribute that to upstream as well (and reusing this ticket :P)

https://github.com/reddit/baseplate.go/blob/839af98823fe610b5ef59b509d5ecd14686e3a7e/thriftbp/client_middlewares.go#L28-L64
is the middleware definition part, basically we just wrap TClient into a WrappedTClient. It's
simpler than the server side as we don't have to make any breaking changes :)

A few lines down, https://github.com/reddit/baseplate.go/blob/839af98823fe610b5ef59b509d5ecd14686e3a7e/thriftbp/client_middlewares.go#L66-L93
is an example of how we have a tracing middleware that auto creates a client child-span and
inject that into the context object (so it will be translate into THeaderProtocol over the
wire by the client) before send that to the client.

What do you think, [~dcelasun]?

> Go middleware support
> ---------------------
>
>                 Key: THRIFT-5164
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5164
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Go - Library
>            Reporter: Yuxuan Wang
>            Assignee: Duru Can Celasun
>            Priority: Major
>              Labels: Breaking-Change
>             Fix For: 0.14.0
>
>
> I saw that this idea was discussed before in THRIFT-4553, but want to reopen the discussion
to see if there's a change of mind.
> We (Reddit) recently implemented TProcessor level middleware support in our Baseplate.go
library, and we think that our implementation is generic enough that it might make sense to
contribute that into the thrift library. The related implementation are all in this file:
https://github.com/reddit/baseplate.go/blob/4225e42dc8dde56b222ac7ea3a4ff63aa726f6a6/thriftbp/middlewares.go
> https://github.com/reddit/baseplate.go/blob/4225e42dc8dde56b222ac7ea3a4ff63aa726f6a6/tracing/middlewares.go#L40-L64
is an example of how a tracing middleware is implemented.
> If we think that's a good idea, then we can contribute that into thrift repo (with renames,
of course). One implementation detail I'm not sure is that whether we want to expand the TProcessor
interface to also include ProcessorMap and AddToProcessorMap, or do we want to keep the two
iinterfaces separate.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message