Skip to content

Commit

Permalink
[WFLY-11796] Deployment metrics are whitelisted
Browse files Browse the repository at this point in the history
* Update the `isExposingMetrics` method to take into account subsystem
  in deployment addresses.

JIRA: https://issues.jboss.org/browse/WFLY-11796
  • Loading branch information
jmesnil committed Feb 28, 2019
1 parent 5f6101e commit 924a5d6
Showing 1 changed file with 13 additions and 5 deletions.
Expand Up @@ -174,17 +174,25 @@ private boolean isExposingMetrics(PathAddress address) {
if (address.size() == 0) {
return true;
}
if (address.getElement(0).getKey().equals(DEPLOYMENT)) {
return true;
}
if (address.getElement(0).getKey().equals(SUBSYSTEM)) {
String subsystemName = address.getElement(0).getValue();
String subsystemName = getSubsystemName(address);
if (subsystemName != null) {
return exposeAnySubsystem || exposedSubsystems.contains(subsystemName);
}
// do not expose metrics for resources outside the subsystems and deployments.
return false;
}

private String getSubsystemName(PathAddress address) {
if (address.size() == 0) {
return null;
}
if (address.getElement(0).getKey().equals(SUBSYSTEM)) {
return address.getElement(0).getValue();
} else {
return getSubsystemName(address.subAddress(1));
}
}

void collectMetricFamilies(ImmutableManagementResourceRegistration managementResourceRegistration,
final PathAddress address) {
if (!isExposingMetrics(address)) {
Expand Down

0 comments on commit 924a5d6

Please sign in to comment.