public static boolean isSampled(final ServerWebExchange exchange, final SelectorData selectorData) {
        return Optional.ofNullable(AbstractLogPluginDataHandler.getSelectApiConfigMap().get(selectorData.getId()))
                .map(GenericApiConfig::getSampler)
                .map(sampler -> sampler.isSampled(exchange, selectorData))
                .orElseGet(() -> Optional.ofNullable(AbstractLogPluginDataHandler.getPluginGlobalConfigMap().get(selectorData.getPluginId()))
                        .map(GenericGlobalConfig::getSampler)
                        .map(sampler -> sampler.isSampled(exchange, selectorData))
                        .orElse(true));
    }
judge whether sample.

@param exchange     exchange
@param selectorData selectorData
@return whether sample
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtils.java