final EndpointRegistry registry = (EndpointRegistry) controller.getValue();
final Endpoint endpoint = registry.getEndpoint(endpointObjectName);
final ModelNode result = new ModelNode();
if (endpoint != null && endpoint.getEndpointMetrics() != null) {
final EndpointMetrics endpointMetrics = endpoint.getEndpointMetrics();
if (MIN_PROCESSING_TIME.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getMinProcessingTime()));
} else if (MAX_PROCESSING_TIME.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getMaxProcessingTime()));
} else if (AVERAGE_PROCESSING_TIME.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getTotalProcessingTime()));
} else if (TOTAL_PROCESSING_TIME.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getTotalProcessingTime()));
} else if (REQUEST_COUNT.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getRequestCount()));
} else if (RESPONSE_COUNT.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getResponseCount()));
} else if (FAULT_COUNT.equals(metricName)) {
result.set(String.valueOf(endpointMetrics.getFaultCount()));
}
} else {
result.set(getFallbackMessage());
}