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

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")

Add ArrayList<Object> list in StatisticsReport Class for new return values. 


PAP Provider part:

[TODO]
The return example in Policy Design and API Flow) only show the one statictics record for each PDP instance.
Do we need to return all the history data?

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

[Todo]
Can we also store PDPGroup and PDPSubGroup info for each Pdp Instance in PdpStatictics table? The query flow would be easier.

Policy model PdpProvider part:

Add Class PdpStatisticProvider for new table.
Methods including:

PdpStatisticProvider().getPdpStatistics(pfDao,name)

PdpStatisticProvider().updatePdpStatistics(PfDao, pdpInstanceId, pdpStatistics)

PdpStatisticProvider().deletePdpGroup(pfDao, name)

 List<PdpStatistics> getFilteredPdpPdpStatistics(PdpStatisticsGroupFilter filter)

Also need to update the definition in PolicyModelsProvider

[Todo]
Is there any other API need for this new table PdpStatistics?