use of org.wildfly.extension.metrics.MetricRegistry in project wildfly by wildfly.
the class DeploymentMetricService method install.
public static void install(ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, Resource rootResource, ManagementResourceRegistration managementResourceRegistration, boolean exposeAnySubsystem, List<String> exposedSubsystems, String prefix) {
PathAddress deploymentAddress = createDeploymentAddressPrefix(deploymentUnit);
ServiceBuilder<?> sb = serviceTarget.addService(deploymentUnit.getServiceName().append("metrics"));
Supplier<MetricCollector> metricCollector = sb.requires(WILDFLY_COLLECTOR);
Supplier<MetricRegistry> metricRegistry = sb.requires(METRICS_REGISTRY_RUNTIME_CAPABILITY.getCapabilityServiceName());
Supplier<Executor> managementExecutor = sb.requires(ServerService.EXECUTOR_CAPABILITY.getCapabilityServiceName());
/*
* The deployment metric service depends on the deployment complete service name to ensure that the metrics from
* the deployment are collected and registered once the deployment services have all been properly installed.
*/
sb.requires(DeploymentCompleteServiceProcessor.serviceName(deploymentUnit.getServiceName()));
sb.setInstance(new DeploymentMetricService(rootResource, managementResourceRegistration, deploymentAddress, metricCollector, metricRegistry, managementExecutor, exposeAnySubsystem, exposedSubsystems, prefix)).install();
}
Aggregations