Search in sources :

Example 21 with InvalidRequestParamValueException

use of com.linkedin.databus2.core.container.request.InvalidRequestParamValueException in project databus by linkedin.

the class ClientStatsRequestProcessor method processOutboundHttpSourceStats.

private void processOutboundHttpSourceStats(DatabusRequest request) throws IOException, RequestProcessingException {
    String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
    String sourceIdStr = category.substring(INBOUND_HTTP_SOURCE_PREFIX.length());
    int sourceId = -1;
    try {
        sourceId = Integer.valueOf(sourceIdStr);
    } catch (NumberFormatException nfe) {
        throw new InvalidRequestParamValueException(request.getName(), INBOUND_HTTP_SOURCE_PREFIX, sourceIdStr);
    }
    DbusHttpTotalStats sourceStats = _client.getHttpStatsCollector().getSourceStats(sourceId);
    if (null == sourceStats) {
        throw new InvalidRequestParamValueException(request.getName(), INBOUND_HTTP_SOURCE_PREFIX, sourceIdStr);
    }
    writeJsonObjectToResponse(sourceStats, request);
    if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
        enableOrResetStatsMBean(sourceStats, request);
    }
}
Also used : DbusHttpTotalStats(com.linkedin.databus2.core.container.monitoring.mbean.DbusHttpTotalStats) InvalidRequestParamValueException(com.linkedin.databus2.core.container.request.InvalidRequestParamValueException)

Aggregations

InvalidRequestParamValueException (com.linkedin.databus2.core.container.request.InvalidRequestParamValueException)20 ArrayList (java.util.ArrayList)6 LogicalSource (com.linkedin.databus.core.data_model.LogicalSource)4 DbusHttpTotalStats (com.linkedin.databus2.core.container.monitoring.mbean.DbusHttpTotalStats)4 PhysicalPartition (com.linkedin.databus.core.data_model.PhysicalPartition)3 HttpStatisticsCollector (com.linkedin.databus2.core.container.monitoring.mbean.HttpStatisticsCollector)3 RequestProcessingException (com.linkedin.databus2.core.container.request.RequestProcessingException)3 IOException (java.io.IOException)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 DatabusV3Registration (com.linkedin.databus.client.pub.DatabusV3Registration)2 RegistrationId (com.linkedin.databus.client.pub.RegistrationId)2 DbusEventsTotalStats (com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats)2 IdNamePair (com.linkedin.databus.core.util.IdNamePair)2 DatabusException (com.linkedin.databus2.core.DatabusException)2 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 DatabusV3MultiPartitionRegistration (com.linkedin.databus.client.pub.DatabusV3MultiPartitionRegistration)1 RegisterRequestProcessor (com.linkedin.databus.container.request.RegisterRequestProcessor)1