Skip to content

RANGER-3905: Ranger metrics on audit throughput for each of the Ranger Service plugins - #1154

Open
RakeshGuptaDev wants to merge 2 commits into
apache:masterfrom
RakeshGuptaDev:RANGER-3905_master
Open

RANGER-3905: Ranger metrics on audit throughput for each of the Ranger Service plugins#1154
RakeshGuptaDev wants to merge 2 commits into
apache:masterfrom
RakeshGuptaDev:RANGER-3905_master

Conversation

@RakeshGuptaDev

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Implement new Solr-backed REST APIs to expose audit throughput metrics for each Ranger service plugin.

Endpoints:

/audit/metrics
/audit/metrics/{id}
/audit/metrics/servicetype/{type}/servicename/{name}
/audit/dailymetrics
/audit/daysmetrics

How was this patch tested?

Successfully validated the newly added Solr-backed REST APIs for Ranger audit throughput metrics:

/audit/metrics
/audit/metrics/{id}
/audit/metrics/servicetype/{type}/servicename/{name}
/audit/dailymetrics
/audit/daysmetrics

Security Validation: Confirmed that unauthorized access attempts by accounts with ROLE_USER correctly return an HTTP 403 Forbidden status.

@RakeshGuptaDev
RakeshGuptaDev marked this pull request as ready for review August 13, 2026 15:18
@rameeshm
rameeshm requested review from rameeshm and a lite review from Copilot August 13, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Solr-backed audit-throughput “metrics” APIs to Ranger Admin, exposing latest, hourly (today), and daily (N days) audit counts per service/plugin dimensions, and wires them into Ranger’s API-access control list/mapping.

Changes:

  • Implemented new AuditMetricsREST endpoints under /audit/* and added corresponding API-list entries + UI-tab mapping.
  • Extended SolrAccessAuditsService with Solr JSON-facet queries to produce latest/hourly/daily audit throughput metrics and new DTO/view list wrappers.
  • Added unit tests for the new REST resource and metrics-query behavior; extended RangerSearchUtil/SearchFilter to accept new query params (clientIP, appId).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
security-admin/src/main/java/org/apache/ranger/rest/AuditMetricsREST.java New REST resource exposing audit metrics endpoints and input validation for olderThanInDays.
security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java New Solr JSON-facet query logic and result extraction for metrics (latest/list/by-hours/by-days).
security-admin/src/main/java/org/apache/ranger/security/context/RangerAPIList.java Registers new API names for authorization.
security-admin/src/main/java/org/apache/ranger/security/context/RangerAPIMapping.java Associates new audit-metrics APIs with the Audit tab.
security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java Adds request-to-SearchFilter mapping for clientIP and appId.
agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java Adds new filter keys used by metrics endpoints (clientIP, appId).
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerAuditMetrics.java New DTO for latest/list audit-metrics results.
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerAuditMetricsByHours.java New DTO for hourly metrics results.
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerAuditMetricsByDays.java New DTO for daily metrics results.
security-admin/src/main/java/org/apache/ranger/view/RangerAuditMetricsList.java New VList wrapper for audit metrics list responses.
security-admin/src/main/java/org/apache/ranger/view/RangerAuditMetricsListByHours.java New VList wrapper for hourly metrics responses.
security-admin/src/main/java/org/apache/ranger/view/RangerAuditMetricsListByDays.java New VList wrapper for daily metrics responses.
security-admin/src/test/java/org/apache/ranger/rest/TestAuditMetricsREST.java Unit tests for AuditMetricsREST.
security-admin/src/test/java/org/apache/ranger/solr/SolrAccessAuditsServiceTest.java Unit tests for Solr metrics extraction/query behaviors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants