use of com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStats in project databus by linkedin.
the class ContainerStatsRequestProcessor method processOutboundTrafficClientStats.
private void processOutboundTrafficClientStats(DatabusRequest request) throws IOException, RequestProcessingException {
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String prefix = "outbound/client/";
String client = category.substring(prefix.length());
ContainerTrafficTotalStats clientStats = _containerStatsCollector.getOutboundClientStats(client);
if (null == clientStats) {
throw new InvalidRequestParamValueException(request.getName(), prefix, client);
}
JsonEncoder jsonEncoder = clientStats.createJsonEncoder(Channels.newOutputStream(request.getResponseContent()));
clientStats.toJson(jsonEncoder, null);
if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
enableOrResetStatsMBean(clientStats, request);
}
}
Aggregations