moremind commented on code in PR #5429:
URL: https://github.com/apache/shenyu/pull/5429#discussion_r1475762600


##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtils.java:
##########
@@ -104,7 +104,9 @@ public static boolean isResponseBodyTooLarge(final int 
bodySize) {
      */
     public static boolean isSampled(final ServerWebExchange exchange, final 
SelectorData selectorData) {
         return 
Optional.ofNullable(AbstractLogPluginDataHandler.getSelectApiConfigMap().get(selectorData.getId()))
-                .map(config -> config.getSampler().isSampled(exchange, 
selectorData))
+                .map(genericApiConfig -> 
Optional.ofNullable(genericApiConfig.getSampler()).map(sampler -> 
sampler.isSampled(exchange, selectorData))
+                        .orElseGet(() -> 
Optional.ofNullable(AbstractLogPluginDataHandler.getPluginGlobalConfigMap().get(selectorData.getPluginId()))
+                                .map(config -> 
config.getSampler().isSampled(exchange, selectorData)).orElse(true)))
                 .orElseGet(() -> 
Optional.ofNullable(AbstractLogPluginDataHandler.getPluginGlobalConfigMap().get(selectorData.getPluginId()))

Review Comment:
   repeat logic?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to