Skip to content
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

Add application name to all HTTP protocols #13906

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class AbstractServerTransportListener<HEADER extends RequestMeta
private RpcInvocationBuildContext context;
private HttpMessageListener httpMessageListener;

public AbstractServerTransportListener(FrameworkModel frameworkModel, URL url, HttpChannel httpChannel) {
protected AbstractServerTransportListener(FrameworkModel frameworkModel, URL url, HttpChannel httpChannel) {
this.frameworkModel = frameworkModel;
this.url = url;
this.httpChannel = httpChannel;
Expand Down Expand Up @@ -211,7 +211,10 @@ protected RpcInvocation buildRpcInvocation(RpcInvocationBuildContext context) {
inv.setObjectAttachments(StreamUtils.toAttachments(httpMetadata.headers()));
inv.put(REMOTE_ADDRESS_KEY, httpChannel.remoteAddress());
inv.getAttributes().putAll(context.getAttributes());

String consumerAppName = httpMetadata.headers().getFirst(TripleHeaderEnum.CONSUMER_APP_NAME_KEY.getHeader());
if (null != consumerAppName) {
inv.put(TripleHeaderEnum.CONSUMER_APP_NAME_KEY, consumerAppName);
}
// customizer RpcInvocation
headerFilters.forEach(f -> f.invoke(invoker, inv));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.apache.dubbo.rpc.model.FrameworkModel;
import org.apache.dubbo.rpc.protocol.tri.DescriptorUtils;
import org.apache.dubbo.rpc.protocol.tri.RpcInvocationBuildContext;
import org.apache.dubbo.rpc.protocol.tri.TripleHeaderEnum;
import org.apache.dubbo.rpc.protocol.tri.compressor.DeCompressor;
import org.apache.dubbo.rpc.protocol.tri.compressor.Identity;
import org.apache.dubbo.rpc.protocol.tri.h12.HttpMessageListener;
Expand Down Expand Up @@ -120,11 +119,6 @@ protected RpcInvocation onBuildRpcInvocationCompletion(RpcInvocation invocation)
getContext().getServiceDescriptor().getInterfaceName(),
getContext().getMethodName()));
}
String consumerAppKey =
getHttpMetadata().headers().getFirst(TripleHeaderEnum.CONSUMER_APP_NAME_KEY.getHeader());
if (null != consumerAppKey) {
invocation.put(TripleHeaderEnum.CONSUMER_APP_NAME_KEY, consumerAppKey);
}
return invocation;
}

Expand Down
Loading