use of com.linkedin.databus2.core.container.request.RequestProcessingException in project databus by linkedin.
the class RelayStatsRequestProcessor method processOutboundHttpClientStats.
private void processOutboundHttpClientStats(DatabusRequest request) throws IOException, RequestProcessingException {
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String client = category.substring(OUTBOUND_HTTP_CLIENT_PREFIX.length());
DbusHttpTotalStats clientStats = _relay.getHttpStatisticsCollector().getPeerStats(client);
if (null == clientStats) {
throw new InvalidRequestParamValueException(request.getName(), OUTBOUND_HTTP_CLIENT_PREFIX, client);
}
writeJsonObjectToResponse(clientStats, request);
if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
enableOrResetStatsMBean(clientStats, request);
}
}
use of com.linkedin.databus2.core.container.request.RequestProcessingException in project databus by linkedin.
the class ClientStatsRequestProcessor method processEventsSourceStats.
private void processEventsSourceStats(DbusEventsStatisticsCollector statsCollector, String prefix, DatabusRequest request) throws IOException, RequestProcessingException {
if (null == statsCollector)
return;
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String sourceIdStr = category.substring(prefix.length());
int sourceId = -1;
try {
sourceId = Integer.valueOf(sourceIdStr);
} catch (NumberFormatException nfe) {
throw new InvalidRequestParamValueException(request.getName(), prefix, sourceIdStr);
}
DbusEventsTotalStats sourceStats = statsCollector.getSourceStats(sourceId);
if (null == sourceStats) {
throw new InvalidRequestParamValueException(request.getName(), prefix, sourceIdStr);
}
writeJsonObjectToResponse(sourceStats, request);
if (request.getRequestType() == HttpMethod.PUT || request.getRequestType() == HttpMethod.POST) {
enableOrResetStatsMBean(sourceStats, request);
}
}
use of com.linkedin.databus2.core.container.request.RequestProcessingException 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);
}
}
Aggregations