Merge pull request #94 from SkyeBeFreeman/greenwich-new

feat:release 1.2.0-Greenwich
pull/99/head 1.2.0-Greenwich
lepdou 3 years ago committed by GitHub
commit faf95877e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -77,7 +77,7 @@
<properties> <properties>
<!-- Project revision --> <!-- Project revision -->
<revision>1.2.0-Greenwich-SNAPSHOT</revision> <revision>1.2.0-Greenwich</revision>
<!-- Spring Cloud --> <!-- Spring Cloud -->
<spring.cloud.version>Greenwich.SR6</spring.cloud.version> <spring.cloud.version>Greenwich.SR6</spring.cloud.version>

@ -41,13 +41,14 @@ public class MetadataFeignAspect {
/** /**
* Get service name before execution of Feign client. * Get service name before execution of Feign client.
*
* @param joinPoint join point * @param joinPoint join point
*/ */
@Before("execute()") @Before("execute()")
public void doBefore(JoinPoint joinPoint) { public void doBefore(JoinPoint joinPoint) {
Request request = (Request) joinPoint.getArgs()[0]; Request request = (Request) joinPoint.getArgs()[0];
MetadataContextHolder.get().putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE, MetadataContextHolder.get().putSystemMetadata(
MetadataConstant.SystemMetadataKey.PEER_SERVICE,
URI.create(request.url()).getAuthority()); URI.create(request.url()).getAuthority());
} }
} }

@ -55,27 +55,33 @@ public class MetadataFirstScgFilter implements GlobalFilter, Ordered {
Route route = exchange.getAttribute(GATEWAY_ROUTE_ATTR); Route route = exchange.getAttribute(GATEWAY_ROUTE_ATTR);
// get metadata of current thread // get metadata of current thread
MetadataContext metadataContext = exchange.getAttribute(MetadataConstant.HeaderName.METADATA_CONTEXT); MetadataContext metadataContext = exchange
.getAttribute(MetadataConstant.HeaderName.METADATA_CONTEXT);
if (metadataContext == null) { if (metadataContext == null) {
metadataContext = MetadataContextHolder.get(); metadataContext = MetadataContextHolder.get();
} }
// TODO The peer namespace is temporarily the same as the local namespace // TODO The peer namespace is temporarily the same as the local namespace
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_NAMESPACE, metadataContext.putSystemMetadata(
MetadataConstant.SystemMetadataKey.PEER_NAMESPACE,
MetadataContext.LOCAL_NAMESPACE); MetadataContext.LOCAL_NAMESPACE);
if (route != null) { if (route != null) {
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE, metadataContext.putSystemMetadata(
MetadataConstant.SystemMetadataKey.PEER_SERVICE,
route.getUri().getAuthority()); route.getUri().getAuthority());
} }
else { else {
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_SERVICE, metadataContext.putSystemMetadata(
MetadataConstant.SystemMetadataKey.PEER_SERVICE,
exchange.getRequest().getURI().getAuthority()); exchange.getRequest().getURI().getAuthority());
} }
metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_PATH, metadataContext.putSystemMetadata(MetadataConstant.SystemMetadataKey.PEER_PATH,
exchange.getRequest().getURI().getPath()); exchange.getRequest().getURI().getPath());
exchange.getAttributes().put(MetadataConstant.HeaderName.METADATA_CONTEXT, metadataContext); exchange.getAttributes().put(MetadataConstant.HeaderName.METADATA_CONTEXT,
metadataContext);
return chain.filter(exchange); return chain.filter(exchange);
} }
} }

@ -62,7 +62,7 @@
</developers> </developers>
<properties> <properties>
<revision>1.2.0-Greenwich-SNAPSHOT</revision> <revision>1.2.0-Greenwich</revision>
<polaris.version>1.3.1</polaris.version> <polaris.version>1.3.1</polaris.version>
<!-- Dependencies --> <!-- Dependencies -->

Loading…
Cancel
Save