See discussion on https://github.com/wildfly/wildfly/pull/13871
Do we have MetricsCollector collecting the container metrics multiple times?
I haven't thought hard about this, but doesn't the Stage.VERIFY collection in MetricsSubsystemAdd end up re-collecting all the deployment=* subtree metrics already collected in Stage.RUNTIME via DeploymentMetricProcessor/DeploymentMetricService? It walks the whole resource tree from the root.
If the MP Metrics subsystem is installed, isn't MicroProfileMetricsSubsystemAdd and that subsystem's DeploymentMetricProcessor/DeploymentMetricService also collecting the same set of metrics?
I'm filing this as a Task because maybe all that's needed is to investigate and answer those questions reporting that all is well. But if all isn't well this should converted to a Bug.
Also, as discussed on PR #13871, https://github.com/wildfly/wildfly/blob/22.0.0.Final/metrics/src/main/java/org/wildfly/extension/metrics/MetricCollector.java#L133-L134 is probably not the best idiom given the code is iterating over runtime-only resources, where the cost of hasChildren can be high.