Search in sources :

Example 1 with ContainerTrafficTotalStatsMBean

use of com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStatsMBean in project databus by linkedin.

the class ContainerStatsRequestProcessor method processOutboundTrafficTotalStats.

private void processOutboundTrafficTotalStats(DatabusRequest request) throws IOException {
    ContainerTrafficTotalStatsMBean outboundTrafficTotalStatsMBean = _containerStatsCollector.getOutboundTrafficTotalStats();
    if (null == outboundTrafficTotalStatsMBean)
        return;
    // String json = outboundTrafficTotalStatsMBean.toJson();
    JsonEncoder jsonEncoder = outboundTrafficTotalStatsMBean.createJsonEncoder(Channels.newOutputStream(request.getResponseContent()));
    outboundTrafficTotalStatsMBean.toJson(jsonEncoder, null);
    if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
        enableOrResetStatsMBean(outboundTrafficTotalStatsMBean, request);
    }
}
Also used : ContainerTrafficTotalStatsMBean(com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStatsMBean) JsonEncoder(org.apache.avro.io.JsonEncoder)

Example 2 with ContainerTrafficTotalStatsMBean

use of com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStatsMBean in project databus by linkedin.

the class ContainerStatsRequestProcessor method processInboundTrafficTotalStats.

private void processInboundTrafficTotalStats(DatabusRequest request) throws IOException {
    ContainerTrafficTotalStatsMBean inboundTrafficTotalStatsMBean = _containerStatsCollector.getInboundTrafficTotalStats();
    if (null == inboundTrafficTotalStatsMBean)
        return;
    // String json = inboundTrafficTotalStatsMBean.toJson();
    JsonEncoder jsonEncoder = inboundTrafficTotalStatsMBean.createJsonEncoder(Channels.newOutputStream(request.getResponseContent()));
    inboundTrafficTotalStatsMBean.toJson(jsonEncoder, null);
    if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
        enableOrResetStatsMBean(inboundTrafficTotalStatsMBean, request);
    }
}
Also used : ContainerTrafficTotalStatsMBean(com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStatsMBean) JsonEncoder(org.apache.avro.io.JsonEncoder)

Aggregations

ContainerTrafficTotalStatsMBean (com.linkedin.databus2.core.container.monitoring.mbean.ContainerTrafficTotalStatsMBean)2 JsonEncoder (org.apache.avro.io.JsonEncoder)2