This page covers the discussion and design documentation of epic POLICY-2025 - This epic covers the work to ensure all the PDP’s report statistics and that both the statistics and health checks are consolidated by the PAP.
POLICY-1628 Create policy model provider for PdpStatistics entity
POLICY-1629 PAP REST API for PDPGroup Statistics
POLICY-1689 Consolidate Policy Health Check into PAP
POLICY-2022 All PDPs should support statistics
1 Create policy model provider for PdpStatistics entity
(Leading @Tim Huang)
Add Class PdpStatisticProvider for new table(PdpStatistic).
Methods including:
List<PdpStatistics> PdpStatisticProvider().getPdpStatistics(pfDao,name)
PdpStatisticProvider().updatePdpStatistics(PfDao, pdpInstanceId, pdpStatistics)
PdpStatisticProvider().deletePdpStatistics(pfDao, name)
List<PdpStatistics> getFilteredPdpPdpStatistics(PdpStatisticsGroupFilter filter)
Also need to update the definition in PolicyModelsProvider
[Todo]
- Question: Consider the table PdpStatistic, is it enough with the columns listed as below?
private String pdpInstanceId; private Date timeStamp; private long policyDeployCount; private long policyDeploySuccessCount; private long policyDeployFailCount; private long policyExecutedCount; private long policyExecutedSuccessCount; private long policyExecutedFailCount; [TODO] Also need to store PDPGroup and PDPSubGroup info for each Pdp Instance in PdpStatictics table, because PdpGroup table may already changed, but Statictics remains.
- Question: Is there any other API need for this new table PdpStatistics?
- Question: Do we need more seperate tables to store other PDP status history info, like PDP state, Health check etc?
2 Rest API for PDP statistics
(Leading @Ning Xi)
PAP Rest Controller part:
We add 3 new Rest path for PDP/PDP group/PDP subgroup staticstics following the definition in page
Policy Design and API Flow)
3.3.5 PDP Group Statistics
@Path("pdps/statistics")
@Path("pdps/groups/{name}/statistics")
@Path("pdps/groups/{name}/subgroups/{type}/statistics")
- Question: Do we need two REST API, one for returning latest statistics, another for returning all the history data?
Add ArrayList<Object> list in StatisticsReport Class for new return values.
PAP Provider part:
Since Statistics db table is standalone,
Get Statistics result need three steps
query PDP table and get PDPGroup=>PDPSubGroup structure
databaseProvider.getPdpGroups(null)
store PDP instance name to List
List PdpInstancesquery statistics table for each PDP instance
PdpInstances.stream().forEach(s -> {
databaseProvier.getStatictics(s);
});
- Summarize statictics result for PDP subgroups,
also add to StatisticsReport
3 Consolidate Policy Health Check into PAP
(Leading @Yehui Wang)
Currently Policy Health check support to fetch health status of all PDPs registered with PAP and PAP per se.
Considerring requirement in the ticket "report the health check for ALL the policy components" and /wiki/spaces/DW/pages/16394037, there are serveral tasks:
- Get health check on the individual PDPs.
- Get health check on PDPs of specific PDPGroup.
- Get health check on PDPs of specific PDPSubGroup.
- Detailed requirements of /wiki/spaces/DW/pages/16394037
- If use PUT operations for ordering health checks, user only get a HTTP status code of 202: Accepted if the health check request has been accepted by the PAP.
Question: How to secure to GET the latest heal checks afterwards? Solution is to compare the timestamp of PUT request and return timestamp in GET response?