Skip to content

Commit ed7b333

Browse files
jakubskalaksnicoll
authored andcommitted
Add missing descriptions for HTTP Server and Data repositories metrics
See gh-31516
1 parent 0ef213a commit ed7b333

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/data/MetricsRepositoryMethodInvocationListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ public void afterInvocation(RepositoryMethodInvocation invocation) {
8383
Set<Timed> annotations = TimedAnnotations.get(invocation.getMethod(), invocation.getRepositoryInterface());
8484
Iterable<Tag> tags = this.tagsProvider.repositoryTags(invocation);
8585
long duration = invocation.getDuration(TimeUnit.NANOSECONDS);
86-
AutoTimer.apply(this.autoTimer, this.metricName, annotations, (builder) -> builder.tags(tags)
87-
.register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS));
86+
AutoTimer.apply(this.autoTimer, this.metricName, annotations,
87+
(builder) -> builder.description("Duration of repository invocations").tags(tags)
88+
.register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS));
8889
}
8990

9091
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ private void record(ServerWebExchange exchange, Throwable cause, long start) {
109109
Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, cause);
110110
long duration = System.nanoTime() - start;
111111
AutoTimer.apply(this.autoTimer, this.metricName, annotations,
112-
(builder) -> builder.tags(tags).register(this.registry).record(duration, TimeUnit.NANOSECONDS));
112+
(builder) -> builder.description("Duration of HTTP server request handling").tags(tags)
113+
.register(this.registry).record(duration, TimeUnit.NANOSECONDS));
113114
}
114115
catch (Exception ex) {
115116
logger.warn("Failed to record timer metrics", ex);

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private Set<Timed> getTimedAnnotations(Object handler) {
158158

159159
private Timer getTimer(Builder builder, Object handler, HttpServletRequest request, HttpServletResponse response,
160160
Throwable exception) {
161-
return builder.tags(this.tagsProvider.getTags(request, response, handler, exception)).register(this.registry);
161+
return builder.description("Duration of HTTP server request handling")
162+
.tags(this.tagsProvider.getTags(request, response, handler, exception)).register(this.registry);
162163
}
163164

164165
/**

0 commit comments

Comments
 (0)