fix:fix fetching wrong PEER_SERVICE in SCG filter.

pull/80/head
skyehtzhang 2 years ago
parent 13cc0b1fec
commit 9dd1423594

@ -63,7 +63,14 @@ public class MetadataFirstScgFilter implements GlobalFilter, Ordered {
// TODO The peer namespace is temporarily the same as the local namespace
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_NAMESPACE,
MetadataContext.LOCAL_NAMESPACE);
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE, route.getId());
if (route != null) {
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE,
route.getUri().getAuthority());
}
else {
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE,
exchange.getRequest().getURI().getAuthority());
}
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_PATH,
exchange.getRequest().getURI().getPath());
@ -71,5 +78,4 @@ public class MetadataFirstScgFilter implements GlobalFilter, Ordered {
return chain.filter(exchange);
}
}

Loading…
Cancel
Save