use of org.jboss.wsf.spi.management.EndpointMetrics in project wildfly by wildfly.
the class WSEndpointMetrics method getEndpointMetricsFragment.
@SuppressWarnings("unchecked")
private ModelNode getEndpointMetricsFragment(final ModelNode operation, final ServiceRegistry registry) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
String endpointId;
try {
endpointId = URLDecoder.decode(address.getLastElement().getValue(), "UTF-8");
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
final String metricName = operation.require(NAME).asString();
final String webContext = endpointId.substring(0, endpointId.indexOf(":"));
final String endpointName = endpointId.substring(endpointId.indexOf(":") + 1);
ServiceName endpointServiceName = WSServices.ENDPOINT_SERVICE.append("context=" + webContext).append(endpointName);
ServiceController<Endpoint> service = (ServiceController<Endpoint>) currentServiceContainer().getService(endpointServiceName);
Endpoint endpoint = service.getValue();
if (endpoint == null) {
throw new OperationFailedException(WSLogger.ROOT_LOGGER.noMetricsAvailable());
}
final ModelNode result = new ModelNode();
final EndpointMetrics endpointMetrics = endpoint.getEndpointMetrics();
if (MIN_PROCESSING_TIME.getName().equals(metricName)) {
result.set(endpointMetrics.getMinProcessingTime());
} else if (MAX_PROCESSING_TIME.getName().equals(metricName)) {
result.set(endpointMetrics.getMaxProcessingTime());
} else if (AVERAGE_PROCESSING_TIME.getName().equals(metricName)) {
result.set(endpointMetrics.getAverageProcessingTime());
} else if (TOTAL_PROCESSING_TIME.getName().equals(metricName)) {
result.set(endpointMetrics.getTotalProcessingTime());
} else if (REQUEST_COUNT.getName().equals(metricName)) {
result.set(endpointMetrics.getRequestCount());
} else if (RESPONSE_COUNT.getName().equals(metricName)) {
result.set(endpointMetrics.getResponseCount());
} else if (FAULT_COUNT.getName().equals(metricName)) {
result.set(endpointMetrics.getFaultCount());
}
return result;
}
use of org.jboss.wsf.spi.management.EndpointMetrics in project jbossws-cxf by jbossws.
the class RequestHandlerImpl method initRequestMetrics.
private long initRequestMetrics(Endpoint endpoint) {
long beginTime = 0;
EndpointMetrics metrics = endpoint.getEndpointMetrics();
if (metrics != null)
beginTime = metrics.processRequestMessage();
return beginTime;
}
Aggregations