mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge branch '2.7.x'
Closes gh-31707
This commit is contained in:
commit
8e3aaf1cf4
@ -68,8 +68,9 @@ public class MetricsRepositoryMethodInvocationListener implements RepositoryMeth
|
|||||||
Set<Timed> annotations = TimedAnnotations.get(invocation.getMethod(), invocation.getRepositoryInterface());
|
Set<Timed> annotations = TimedAnnotations.get(invocation.getMethod(), invocation.getRepositoryInterface());
|
||||||
Iterable<Tag> tags = this.tagsProvider.repositoryTags(invocation);
|
Iterable<Tag> tags = this.tagsProvider.repositoryTags(invocation);
|
||||||
long duration = invocation.getDuration(TimeUnit.NANOSECONDS);
|
long duration = invocation.getDuration(TimeUnit.NANOSECONDS);
|
||||||
AutoTimer.apply(this.autoTimer, this.metricName, annotations, (builder) -> builder.tags(tags)
|
AutoTimer.apply(this.autoTimer, this.metricName, annotations,
|
||||||
.register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS));
|
(builder) -> builder.description("Duration of repository invocations").tags(tags)
|
||||||
|
.register(this.registrySupplier.get()).record(duration, TimeUnit.NANOSECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,8 @@ public class MetricsWebFilter implements WebFilter {
|
|||||||
Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, cause);
|
Iterable<Tag> tags = this.tagsProvider.httpRequestTags(exchange, cause);
|
||||||
long duration = System.nanoTime() - start;
|
long duration = System.nanoTime() - start;
|
||||||
AutoTimer.apply(this.autoTimer, this.metricName, annotations,
|
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) {
|
catch (Exception ex) {
|
||||||
logger.warn("Failed to record timer metrics", ex);
|
logger.warn("Failed to record timer metrics", ex);
|
||||||
|
@ -155,7 +155,8 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
|||||||
|
|
||||||
private Timer.Builder getTimer(Builder builder, Object handler, HttpServletRequest request,
|
private Timer.Builder getTimer(Builder builder, Object handler, HttpServletRequest request,
|
||||||
HttpServletResponse response, Throwable exception) {
|
HttpServletResponse response, Throwable exception) {
|
||||||
return builder.tags(this.tagsProvider.getTags(request, response, handler, exception));
|
return builder.description("Duration of HTTP server request handling")
|
||||||
|
.tags(this.tagsProvider.getTags(request, response, handler, exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user