(search-service) Fix metrics for errors and request times

This was previously in place, but broke during the jooby migration.
This commit is contained in:
Viktor Lofgren 2025-01-08 14:10:43 +01:00
parent 5fb76b2e79
commit b7f0a2a98e

View File

@ -68,12 +68,12 @@ public class SearchService extends JoobyService {
jooby.after((Context ctx, Object result, Throwable failure) -> { jooby.after((Context ctx, Object result, Throwable failure) -> {
if (failure != null) { if (failure != null) {
wmsa_search_service_error_count.labels(ctx.getRoute().getPattern(), ctx.getContextPath()).inc(); wmsa_search_service_error_count.labels(ctx.getRoute().getPattern(), ctx.getMethod()).inc();
} }
else { else {
Long startTime = ctx.getAttribute(startTimeAttribute); Long startTime = ctx.getAttribute(startTimeAttribute);
if (startTime != null) { if (startTime != null) {
wmsa_search_service_request_time.labels(ctx.getRoute().getPattern(), ctx.getContextPath()) wmsa_search_service_request_time.labels(ctx.getRoute().getPattern(), ctx.getMethod())
.observe((System.nanoTime() - startTime) / 1e9); .observe((System.nanoTime() - startTime) / 1e9);
} }
} }