Skip to content

Commit 0bb7532

Browse files
authored
Use unified entrance context name by default in Spring WebFlux adapter (#2610)
1 parent 42878a2 commit 0bb7532

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • sentinel-adapter/sentinel-spring-webflux-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/spring/webflux

sentinel-adapter/sentinel-spring-webflux-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/spring/webflux/SentinelWebFluxFilter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
*/
3737
public class SentinelWebFluxFilter implements WebFilter {
3838

39+
public static final String SENTINEL_SPRING_WEBFLUX_CONTEXT_NAME = "sentinel_spring_webflux_context";
40+
3941
@Override
4042
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
4143
// Maybe we can get the URL pattern elsewhere via:
@@ -56,7 +58,11 @@ private SentinelReactorTransformer<Void> buildSentinelTransformer(ServerWebExcha
5658
.orElse(EMPTY_ORIGIN);
5759

5860
return new SentinelReactorTransformer<>(new EntryConfig(finalPath, ResourceTypeConstants.COMMON_WEB,
59-
EntryType.IN, new ContextConfig(finalPath, origin)));
61+
EntryType.IN, new ContextConfig(getContextName(exchange), origin)));
62+
}
63+
64+
protected String getContextName(ServerWebExchange exchange){
65+
return SENTINEL_SPRING_WEBFLUX_CONTEXT_NAME;
6066
}
6167

6268
private static final String EMPTY_ORIGIN = "";

0 commit comments

Comments
 (0)