-
Notifications
You must be signed in to change notification settings - Fork 939
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
Introduce BraveRpcService
#6115
base: main
Are you sure you want to change the base?
Conversation
1c0572c
to
c53cb0a
Compare
73dca92
to
7f89976
Compare
* Decorates an {@link RpcService} to trace inbound {@link RpcRequest}s using | ||
* <a href="https://github.com/openzipkin/brave">Brave</a>. | ||
*/ | ||
public final class BraveRpcService extends SimpleDecoratingRpcService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question) Is it possible to share the common logic with BraveService
by adding AbstractBraveService
and extending it, as you did in AbstractMetricCollectingClient
?
super(delegate); | ||
} | ||
|
||
O serve0(ServiceRequestContext ctx, I req, BI braveReq, Span span) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This abstraction is slightly different from what I had in mind.
Instead of enforcing the subclass to call serve0()
after preprocessing, should we handle all processes in AbstractBraveService
but delegate the domain-specific part to the subclasses?
What do you think of this direction?
abstract class AbstractBraveService<BI extends brave.Request, BO extends brave.Response, ...>
abstract BI braveRequest(ServiceRequestContext ctx, I req);
abstract BO braveResponse(ServiceRequestContext ctx, RequestLog log, BI braveReq);
abstract Span handleReceive(BI braveReq);
abstract void handleSend(BO response, Span span);
@Override
public final O serve(ServiceRequestContext ctx, I req) throws Exception {
if (!ctx.config().transientServiceOptions().contains(TransientServiceOption.WITH_TRACING)) {
return unwrap().serve(ctx, req);
}
final BI braveReq = braveRequest(ctx, req);
final Span span = handleReceive(braveReq);
...
}
Motivation:
The motivation for this PR is better described in #6084
The changeset in this PR attempts to:
ArmeriaHttpServerParser
andArmeriaRpcServerParser
BraveService
orBraveRpcService
. This can provide more flexibility on whether to use onlyBraveService
, onlyBraveRpcService
, or bothBraveService
andBraveRpcService
BraveRpcService
which allows users to perform sampling or request/response parsing based onRpcRequest
Modifications:
BraveRpcService
. By default, armeria-specific tags/annotations recorded byBraveRpcService
is the same asBraveService
ArmeriaHttpServerParser
andArmeriaRpcServerParser
to allow users to easily construct aRpcTracing
orHttpTracing
Result:
RpcRequest
,RpcResponse
to apply sampling/tags/annotations