Use unified entrance context name by default in Spring WebFlux adapter (#2610)
This commit is contained in:
parent
42878a29e0
commit
0bb7532425
|
|
@ -36,6 +36,8 @@ import reactor.core.publisher.Mono;
|
||||||
*/
|
*/
|
||||||
public class SentinelWebFluxFilter implements WebFilter {
|
public class SentinelWebFluxFilter implements WebFilter {
|
||||||
|
|
||||||
|
public static final String SENTINEL_SPRING_WEBFLUX_CONTEXT_NAME = "sentinel_spring_webflux_context";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
||||||
// Maybe we can get the URL pattern elsewhere via:
|
// Maybe we can get the URL pattern elsewhere via:
|
||||||
|
|
@ -56,7 +58,11 @@ public class SentinelWebFluxFilter implements WebFilter {
|
||||||
.orElse(EMPTY_ORIGIN);
|
.orElse(EMPTY_ORIGIN);
|
||||||
|
|
||||||
return new SentinelReactorTransformer<>(new EntryConfig(finalPath, ResourceTypeConstants.COMMON_WEB,
|
return new SentinelReactorTransformer<>(new EntryConfig(finalPath, ResourceTypeConstants.COMMON_WEB,
|
||||||
EntryType.IN, new ContextConfig(finalPath, origin)));
|
EntryType.IN, new ContextConfig(getContextName(exchange), origin)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getContextName(ServerWebExchange exchange){
|
||||||
|
return SENTINEL_SPRING_WEBFLUX_CONTEXT_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String EMPTY_ORIGIN = "";
|
private static final String EMPTY_ORIGIN = "";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue