diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/data/MetricsRepositoryMethodInvocationListener.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/data/MetricsRepositoryMethodInvocationListener.java index add03dc691..3ec34bc71a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/data/MetricsRepositoryMethodInvocationListener.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/data/MetricsRepositoryMethodInvocationListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,8 +83,9 @@ public class MetricsRepositoryMethodInvocationListener implements RepositoryMeth Set annotations = TimedAnnotations.get(invocation.getMethod(), invocation.getRepositoryInterface()); Iterable tags = this.tagsProvider.repositoryTags(invocation); long duration = invocation.getDuration(TimeUnit.NANOSECONDS); - AutoTimer.apply(this.autoTimer, this.metricName, annotations, (builder) -> builder.tags(tags) - .register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS)); + AutoTimer.apply(this.autoTimer, this.metricName, annotations, + (builder) -> builder.description("Duration of repository invocations").tags(tags) + .register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS)); } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java index 357ca2f760..2609055f06 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,8 @@ public class MetricsWebFilter implements WebFilter { Iterable tags = this.tagsProvider.httpRequestTags(exchange, cause); long duration = System.nanoTime() - start; AutoTimer.apply(this.autoTimer, this.metricName, annotations, - (builder) -> builder.tags(tags).register(this.registry).record(duration, TimeUnit.NANOSECONDS)); + (builder) -> builder.description("Duration of HTTP server request handling").tags(tags) + .register(this.registry).record(duration, TimeUnit.NANOSECONDS)); } catch (Exception ex) { logger.warn("Failed to record timer metrics", ex); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java index 8838253d0d..ae050db9d8 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -158,7 +158,8 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter { private Timer getTimer(Builder builder, Object handler, HttpServletRequest request, HttpServletResponse response, Throwable exception) { - return builder.tags(this.tagsProvider.getTags(request, response, handler, exception)).register(this.registry); + return builder.description("Duration of HTTP server request handling") + .tags(this.tagsProvider.getTags(request, response, handler, exception)).register(this.registry); } /**