forked from lsmyrnaios/UrlsController
Add the "getNumberOfPayloadsForDatasource" endpoint.
This commit is contained in:
parent
1b14a7e554
commit
d7797eaaf6
|
@ -10,8 +10,10 @@ The database used is the [Impala](https://impala.apache.org/).<br>
|
|||
This endpoint returns the total number of payloads existing in the database, independently of the way they were aggregated. This includes the payloads created by other pieces of software, before the PDF-Aggregation-Service was created.
|
||||
- "**getNumberOfPayloadsAggregatedByService**" endpoint: **http://<IP>:<PORT>/api/stats/getNumberOfPayloadsAggregatedByService** <br>
|
||||
This endpoint returns the number of payloads aggregated by the PDF-Aggregated-Service itself. It excludes the payloads aggregated by other methods, by applying a Date-filter for the records created in 2021 or later.
|
||||
- "**getNumberOfPayloadsForDatasource**" endpoint: **http://<IP>:<PORT>/api/stats/getNumberOfPayloadsForDatasource?datasourceId="givenDatasourceId"** <br>
|
||||
This endpoint returns the number of payloads which belong to the datasource specified by the given datasourceID.
|
||||
- "**getNumberOfRecordsInspected**" endpoint: **http://<IP>:<PORT>/api/stats/getNumberOfRecordsInspected** <br>
|
||||
This endpoint returns the number of records inspected by the PDF-Aggregation-Service.
|
||||
This endpoint returns the number of records inspected by the PDF-Aggregation-Service.
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +49,23 @@ public class StatsController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* This endpoint returns the number of payloads related to the given datasourceID.
|
||||
* */
|
||||
@GetMapping("getNumberOfPayloadsForDatasource")
|
||||
public ResponseEntity<?> getNumberOfPayloadsForDatasource(@RequestParam String datasourceId) {
|
||||
logger.info("Received a \"getNumberOfPayloadsForDatasource\" request.");
|
||||
|
||||
final String getPayloadsNumberForDatasourceQuery =
|
||||
"select count(p.id) from " + ImpalaConnector.databaseName + ".payload p\n" +
|
||||
" join " + ImpalaConnector.databaseName + ".publication pu on pu.id=p.id and pu.datasourceid=\"" + datasourceId + "\"";
|
||||
|
||||
logger.trace("getPayloadsNumberForDatasourceQuery:\n" + getPayloadsNumberForDatasourceQuery);
|
||||
|
||||
return statsService.getNumberOfPayloads(getPayloadsNumberForDatasourceQuery, "related to datasourceId \"" + datasourceId + "\"");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This endpoint returns the number of records inspected by the PDF-Aggregation-Service.
|
||||
* */
|
||||
|
|
Loading…
Reference in New Issue