Search in sources :

Example 1 with ContainerTrafficTotalStats

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);
    }
}
Also used : JsonEncoder(org.apache.avro.io.JsonEncoder) ContainerTrafficTotalStats(com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStats)

Aggregations

ContainerTrafficTotalStats (com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStats)1 JsonEncoder (org.apache.avro.io.JsonEncoder)1