This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch 
3072-nullpointer-in-datalakemeasureresourcev4getdatalakeinfos
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/3072-nullpointer-in-datalakemeasureresourcev4getdatalakeinfos by 
this push:
     new 9ae6c01a32 fix(#3072): Change count API endpoint and add documentation
9ae6c01a32 is described below

commit 9ae6c01a329b049367a7048b1c8dd5808cb77e48
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Jul 30 08:53:13 2024 +0200

    fix(#3072): Change count API endpoint and add documentation
---
 .../streampipes/ps/DataLakeMeasureResourceV4.java   | 21 ++++++++++++++++++---
 .../src/lib/apis/datalake-rest.service.ts           |  6 +++---
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git 
a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
 
b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
index f669af7eb0..2e0f902745 100644
--- 
a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
+++ 
b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeMeasureResourceV4.java
@@ -23,6 +23,8 @@ import 
org.apache.streampipes.dataexplorer.management.DataExplorerDispatcher;
 import org.apache.streampipes.model.datalake.DataLakeMeasure;
 import 
org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -59,9 +61,22 @@ public class DataLakeMeasureResourceV4 extends 
AbstractAuthGuardedRestResource {
     return ok(result);
   }
 
-  @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
-  public ResponseEntity<Map<String, Integer>> getDataLakeInfos(
-      @RequestParam(value = "filter") List<String> measurementNames
+  /**
+   * Handles HTTP GET requests to retrieve the entry counts of specified 
measurements.
+   *
+   * @param measurementNames A list of measurement names to return the count.
+   * @return A ResponseEntity containing a map of measurement names and their 
corresponding entry counts.
+   */
+  @Operation(
+      summary = "Retrieve measurement counts",
+      description = "Retrieves the entry counts for the specified measurements 
from the data lake.")
+  @GetMapping(
+      path = "/count",
+      produces = MediaType.APPLICATION_JSON_VALUE)
+  public ResponseEntity<Map<String, Integer>> getEntryCountsOfMeasurments(
+      @Parameter(description = "A list of measurement names to return the 
count.")
+      @RequestParam(value = "measurementNames")
+      List<String> measurementNames
   ) {
     var allMeasurements = this.dataLakeMeasureManagement.getAllMeasurements();
     var result = new DataExplorerDispatcher()
diff --git 
a/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
 
b/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
index aa2e62c1b2..a8e8c8928f 100644
--- 
a/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
+++ 
b/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
@@ -46,11 +46,11 @@ export class DatalakeRestService {
     }
 
     getMeasurementEntryCounts(
-        measurementNameFilter: string[],
+        measurementNames: string[],
     ): Observable<Record<string, number>> {
         return this.http
-            .get(`${this.dataLakeMeasureUrl}`, {
-                params: { filter: measurementNameFilter },
+            .get(`${this.dataLakeMeasureUrl}/count`, {
+                params: { measurementNames: measurementNames },
             })
             .pipe(map(r => r as Record<string, number>));
     }

Reply via email to