Skip to content

Commit

Permalink
Add application name on http1 and http2 (#13906)
Browse files Browse the repository at this point in the history
  • Loading branch information
finefuture authored Mar 12, 2024
1 parent da2dd6d commit cf53c38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
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

0 comments on commit cf53c38

Please sign in to comment.