@Test public void request_type_can_be_set_explicitly() { testRequest("http", 200, "GET", "/search", com.yahoo.jdisc.Request.RequestType.WRITE); var stats = collector.takeStatistics(); assertStatisticsEntryWithRequestTypePresent(stats, "http", "GET", Metrics.RESPONSES_2XX, "write", 1L); }
public List<StatisticsEntry> takeStatistics() { var ret = new ArrayList<StatisticsEntry>(); for (HttpScheme scheme : HttpScheme.values()) { int schemeIndex = scheme.ordinal(); for (HttpMethod method : HttpMethod.values()) { int methodIndex = method.ordinal(); for (int group = 0; group < HTTP_RESPONSE_GROUPS.length; group++) { for (HttpRequest.RequestType type : HttpRequest.RequestType.values()) { long value = statistics[schemeIndex][methodIndex][group][type.ordinal()].sumThenReset(); if (value > 0) { ret.add(new StatisticsEntry(scheme.name().toLowerCase(), method.name(), HTTP_RESPONSE_GROUPS[group], type.name().toLowerCase(), value)); } } } } } return ret; }
HttpResponseStatisticsCollector extends HandlerWrapper implements Graceful { public List<StatisticsEntry> takeStatistics() { var ret = new ArrayList<StatisticsEntry>(); for (HttpScheme scheme : HttpScheme.values()) { int schemeIndex = scheme.ordinal(); for (HttpMethod method : HttpMethod.values()) { int methodIndex = method.ordinal(); for (int group = 0; group < HTTP_RESPONSE_GROUPS.length; group++) { for (HttpRequest.RequestType type : HttpRequest.RequestType.values()) { long value = statistics[schemeIndex][methodIndex][group][type.ordinal()].sumThenReset(); if (value > 0) { ret.add(new StatisticsEntry(scheme.name().toLowerCase(), method.name(), HTTP_RESPONSE_GROUPS[group], type.name().toLowerCase(), value)); } } } } } return ret; } }
HttpResponseStatisticsCollector extends HandlerWrapper implements Graceful { public List<StatisticsEntry> takeStatistics() { var ret = new ArrayList<StatisticsEntry>(); for (HttpScheme scheme : HttpScheme.values()) { int schemeIndex = scheme.ordinal(); for (HttpMethod method : HttpMethod.values()) { int methodIndex = method.ordinal(); for (int group = 0; group < HTTP_RESPONSE_GROUPS.length; group++) { for (HttpRequest.RequestType type : HttpRequest.RequestType.values()) { long value = statistics[schemeIndex][methodIndex][group][type.ordinal()].sumThenReset(); if (value > 0) { ret.add(new StatisticsEntry(scheme.name().toLowerCase(), method.name(), HTTP_RESPONSE_GROUPS[group], type.name().toLowerCase(), value)); } } } } } return ret; } HttpResponseStatisticsCollector(List<String> monitoringHandlerPaths, List<String> searchHandlerPaths); }
HttpResponseStatisticsCollector extends HandlerWrapper implements Graceful { public List<StatisticsEntry> takeStatistics() { var ret = new ArrayList<StatisticsEntry>(); for (HttpScheme scheme : HttpScheme.values()) { int schemeIndex = scheme.ordinal(); for (HttpMethod method : HttpMethod.values()) { int methodIndex = method.ordinal(); for (int group = 0; group < HTTP_RESPONSE_GROUPS.length; group++) { for (HttpRequest.RequestType type : HttpRequest.RequestType.values()) { long value = statistics[schemeIndex][methodIndex][group][type.ordinal()].sumThenReset(); if (value > 0) { ret.add(new StatisticsEntry(scheme.name().toLowerCase(), method.name(), HTTP_RESPONSE_GROUPS[group], type.name().toLowerCase(), value)); } } } } } return ret; } HttpResponseStatisticsCollector(List<String> monitoringHandlerPaths, List<String> searchHandlerPaths); @Override void handle(String path, Request baseRequest, HttpServletRequest request, HttpServletResponse response); List<StatisticsEntry> takeStatistics(); @Override Future<Void> shutdown(); @Override boolean isShutdown(); }
HttpResponseStatisticsCollector extends HandlerWrapper implements Graceful { public List<StatisticsEntry> takeStatistics() { var ret = new ArrayList<StatisticsEntry>(); for (HttpScheme scheme : HttpScheme.values()) { int schemeIndex = scheme.ordinal(); for (HttpMethod method : HttpMethod.values()) { int methodIndex = method.ordinal(); for (int group = 0; group < HTTP_RESPONSE_GROUPS.length; group++) { for (HttpRequest.RequestType type : HttpRequest.RequestType.values()) { long value = statistics[schemeIndex][methodIndex][group][type.ordinal()].sumThenReset(); if (value > 0) { ret.add(new StatisticsEntry(scheme.name().toLowerCase(), method.name(), HTTP_RESPONSE_GROUPS[group], type.name().toLowerCase(), value)); } } } } } return ret; } HttpResponseStatisticsCollector(List<String> monitoringHandlerPaths, List<String> searchHandlerPaths); @Override void handle(String path, Request baseRequest, HttpServletRequest request, HttpServletResponse response); List<StatisticsEntry> takeStatistics(); @Override Future<Void> shutdown(); @Override boolean isShutdown();  }