Нечетный ответ от привода / metrics / http.server.requests - PullRequest
0 голосов
/ 31 января 2020

У меня странный ответ от /actuator/metrics/http.server.requests

{"name":"http.server.requests","baseUnit":"seconds","measurements": 
[{"statistic":"COUNT","value":2.0},{"statistic":"TOTAL_TIME","value":0.325170155}, 
{"statistic":"MAX","value":0.250113973}],"availableTags": 
[{"tag":"requiredMetricName","values":["http.server.requests"]}]}

И все теги не работают

Например

/actuator/metrics/http.server.requests?tag=status:200

получает 404

Я использую Spring boot 2

 implementation 'org.springframework.boot:spring-boot-starter-actuator'

У меня

 public static void main(String[] args) {

    SpringApplication application = new SpringApplication(Application.class);

    Properties properties = new Properties();
    properties.put("management.metrics.web.server.auto-time-requests", true);
    properties.put("management.endpoints.web.exposure.include", "*");
    application.setDefaultProperties(properties);

    application.run(args);
}

1 Ответ

0 голосов
/ 31 января 2020

Похоже, у меня был лишний боб. Это была причина

@Bean
public WebMvcTagsProvider webMvcTagsProvider() {
    return new WebMvcTagsProvider() {
        @Override
        public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler, Throwable exception) {
            return ((Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE))
                    .entrySet()
                    .stream()
                    .map(entry -> new ImmutableTag(entry.getKey(), entry.getValue()))
                    .collect(Collectors.toList());
        }

        @Override
        public Iterable<Tag> getLongRequestTags(HttpServletRequest request, Object handler) {
            return new ArrayList<>();
        }
    };
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...