Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class RangerMetricsFetcher {

private final HashMap<String, Long> summaryReusable = new HashMap<>();
private final HashMap<Integer, Long> summaryPolicy = new HashMap<>();
private final Map<Integer, Long> summaryTagPolicy = new HashMap<>();

public Long getGroupCount() {
Long totalGroupCount = groupService.getAllGroupCount();
Expand Down Expand Up @@ -121,19 +122,21 @@ public Map<String, Long> getPolicyMetrics(Integer policyType) {

Map<String, Long> ret = new HashMap<>();
long total = 0L;
long totalTagPolicies = 0L;

for (Map.Entry<String, Long> entry : svcStore.getPolicyCountByTypeAndServiceType(policyType).entrySet()) {
ret.put(entry.getKey(), entry.getValue());

total += entry.getValue();

if ("tag".equalsIgnoreCase(entry.getKey())) {
summaryReusable.put("TotalTags", entry.getValue());
totalTagPolicies += entry.getValue().longValue();
}
}

ret.put("Total", total);
summaryPolicy.put(policyType, total);
summaryTagPolicy.put(policyType, totalTagPolicies);

return ret;
}
Expand Down Expand Up @@ -174,6 +177,9 @@ public Map<String, Long> getSummary() {
//policies
ret.put("TotalPolicies", summaryPolicy.values().stream().mapToLong(Long::longValue).sum());

//tag_policies
ret.put("TotalTagPolicies", summaryTagPolicy.values().stream().mapToLong(Long::longValue).sum());

//roles
ret.put("TotalRoles", daoMgr.getXXRole().getAllCount());

Expand All @@ -192,6 +198,9 @@ public Map<String, Long> getSummary() {
//x_policy_export_audit
ret.put("TotalPluginDownloads", daoMgr.getXXPolicyExportAudit().getAllCount());

//x_tag
ret.put("TotalTags", daoMgr.getXXTag().getAllCount());

return ret;
}

Expand Down