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?
  • Question: How do we embed specific extra information into the statistics?
  • Action: PDP responsibles come back with the stats they want.
  • Question: How is the table cleared down periodically? MariaDB probably has support for this.

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

...