spring-cloud-alibaba-sentinel add exclude

uz75evzq  于 4个月前  发布在  Spring
关注(0)|答案(2)|浏览(142)

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
We recommend using English. If you are non-native English speaker, you can use the translation software.

Which Component
Sentinel

Is your feature request related to a problem? Please describe.

Actor health check endpoints and sentinel are added to the web project, and / actuator /* of sentinel health check is also monitored in sentinel. Dubbo methods such as com. alibaba. cloud. dubbo. service. DubboMetadata Service: getExportedURLs are also monitored in projects using dubbo.

web 项目中增加了actuator健康检查端点和sentinel,sentinel中健康检查的/actuator/*也在sentinel的监控中,在使用dubbo的项目中com.alibaba.cloud.dubbo.service.DubboMetadataService:getExportedURLs等dubbo方法也在监控住

Describe the solution you'd like

Similar to urlPatterns, excludePatterns options can be added, and resources not included in monitoring can be added using regularization

类似urlPatterns,可以增加excludePatterns选项,可以使用正则添加不纳入监控的资源

yvt65v4c

yvt65v4c2#

I think we could leverage the UrlCleaner to achieve this. Since 1.6.3, when we unify the URL as the empty string, the URL resource will not be included in Sentinel Web filter.

A simple example:

WebCallbackManager.setUrlCleaner(new UrlCleaner() {
    @Override
    public String clean(String originUrl) {
        if (originUrl == null || originUrl.isEmpty()) {
            return "";
        }
        // 不希望统计 *.ico 的资源文件,可以将其转换为 empty string (since 1.6.3)
        if (originUrl.endsWith(".ico")) {
            return "";
        }
        return originUrl;
    }
});

相关问题