Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Table of Contents


Below diagram shows PDPs send heartbeat messages to PolicyAdministration over DMaap, and users get statistics and health checks by PolicyAdministration. 

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?

           

Code Block
languagejava
    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 PdpInstances

  • query statistics table for each PDP instance

 PdpInstances.stream().forEach(s -> {
            databaseProvier.getStatictics(s);
            });
  • Summarize statictics result for PDP subgroups,
    also add to StatisticsReport

...

  1. Get health check on the individual PDPs.
  2. Get health check on PDPs of specific PDPGroup.
  3. Get health check on PDPs of specific PDPSubGroup.
  4. Detailed requirements of /wiki/spaces/DW/pages/16394037
    1.  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.?