Skip to content

Commit

Permalink
Log an error on context path mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed May 18, 2021
1 parent 160dc22 commit 03dea67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ public void handleRequest(String requestPath,
}

if (!requestPath.startsWith(contextRoot)) {
responder.respondWith(500, "The expected context root of metrics is "
+ contextRoot + ", but a request with a different path was routed to MetricsRequestHandler",
Collections.emptyMap());
SmallRyeMetricsLogging.log.contextPathMismatch(contextRoot);
String message = "The expected context root of metrics is "
+ contextRoot + ", but a request with a different path was routed to MetricsRequestHandler";
responder.respondWith(500, message, Collections.emptyMap());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public interface SmallRyeMetricsLogging {
@Message(id = 1300, value = "Unable to export metric %s")
void unableToExport(String name, @Cause Exception e);

@LogMessage(level = Logger.Level.ERROR)
@Message(id = 1301, value = "The expected context root of metrics is \"%s\", but a request with a different " +
"path was routed to MetricsRequestHandler")
void contextPathMismatch(String name);

}

0 comments on commit 03dea67

Please sign in to comment.