java—在spring boot中使用“and”推动测微计标签时,响应体中出现双重异常

k4emjkb1  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(398)

我必须在spring boot中将micrometer标记推入http\u server\u request\u bucket,我使用了从defaultwebmvctags提供程序扩展的类,并使用了gettags和getlongrequesttags方法,如图所示

public class CustomWebMvcTagsProvider extends DefaultWebMvcTagsProvider {

        @Override
        public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler, Throwable exception) {
            return Tags.of(super.getTags(request, response, handler, exception)).and(MetricUtils.getClientTag(request)).and(HotelSearchWebMetricsFilter.getTypeTag(request));
        }

        @Override
        public Iterable<Tag> getLongRequestTags(HttpServletRequest request, Object handler) {
            return Tags.of(super.getLongRequestTags(request, handler)).and(MetricUtils.getClientTag(request)).and(HotelSearchWebMetricsFilter.getTypeTag(request));
        }

我面临的问题是,这里抛出的异常不知怎么翻了一番,我怀疑这是因为推送标记类型的错误用法和方法,也有必要推送标记类型,无法追查引发异常两次的原因

{
    "status": 400,
    "exception": "Mandatory request params for requested filters - userProfileId or fingerprintHash",
    "timestamp": "2020-12-28T16:19:22.849",
    "uuid": "81ba54f5-bcad-4185-8dd6-1588add4e096",
    "message": "BAD_REQUEST"
}{
    "timestamp": "2020-12-28T10:49:23.221+0000",
    "status": 400,
    "error": "Bad Request",
    "message": "Mandatory request params for requested filters - userProfileId or fingerprintHash",
    "path": "/api/"
}

第二个异常不是作为json对象抛出的,因为响应不是json数组。
有人能帮忙吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题