Skip to content

Commit

Permalink
Added method to the name for status code based API metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-s-del committed Apr 18, 2017
1 parent 6ab9e4f commit 7e0787c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.flipkart.poseidon.api.Configuration;
import com.flipkart.poseidon.api.HeaderConfiguration;
import com.flipkart.poseidon.constants.RequestConstants;
import com.flipkart.poseidon.core.RequestContext;
import com.flipkart.poseidon.handlers.http.utils.StringUtils;
import com.flipkart.poseidon.metrics.Metrics;
Expand Down Expand Up @@ -70,7 +71,9 @@ private void ingestResponseBasedMetrics(ServletResponse response) {
// Ingest API response status codes for HttpServletResponse
if (response instanceof HttpServletResponse && !StringUtils.isNullOrEmpty(RequestContext.get(ENDPOINT_NAME))) {
String status = (((HttpServletResponse) response).getStatus() / 100) + "XX";
Metrics.getRegistry().counter("poseidon.api." + RequestContext.get(ENDPOINT_NAME) + "." + status).inc();
Metrics.getRegistry()
.counter("poseidon.api." + RequestContext.get(ENDPOINT_NAME) + "_" + RequestContext.get(RequestConstants.METHOD) + "." + status)
.inc();
}
}

Expand Down

0 comments on commit 7e0787c

Please sign in to comment.