Skip to content

Commit

Permalink
Merge branch '2.6.x' into 2.7.x
Browse files Browse the repository at this point in the history
Closes gh-31706
  • Loading branch information
snicoll committed Jul 13, 2022
2 parents b864755 + bfb4cde commit 3e4a570
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Expand Up @@ -68,8 +68,9 @@ public void afterInvocation(RepositoryMethodInvocation invocation) {
Set<Timed> annotations = TimedAnnotations.get(invocation.getMethod(), invocation.getRepositoryInterface());
Iterable<Tag> 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));
}

}
@@ -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.
Expand Down Expand Up @@ -109,7 +109,8 @@ private void record(ServerWebExchange exchange, Throwable cause, long start) {
Iterable<Tag> 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);
Expand Down
@@ -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.
Expand Down Expand Up @@ -158,7 +158,8 @@ private Set<Timed> getTimedAnnotations(Object handler) {

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);
}

/**
Expand Down

0 comments on commit 3e4a570

Please sign in to comment.