vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add 
dedicated watermarks metric retrieval endpoint
URL: https://github.com/apache/flink/pull/10238#discussion_r351959019
 
 

 ##########
 File path: flink-runtime-web/web-dashboard/src/app/services/metrics.service.ts
 ##########
 @@ -79,36 +79,37 @@ export class MetricsService {
   }
 
   /**
-   * Get watermarks data
+   * Gets the watermarks for a given vertex id.
    * @param jobId
    * @param vertexId
-   * @param parallelism
    */
-  getWatermarks(jobId: string, vertexId: string, parallelism: number) {
-    const listOfMetricName = new Array(parallelism).fill(0).map((_, index) => 
`${index}.currentInputWatermark`);
-    return this.getMetrics(jobId, vertexId, listOfMetricName).pipe(
-      map(metrics => {
-        let minValue = NaN;
-        let lowWatermark = NaN;
-        const watermarks: { [id: string]: number } = {};
-        const ref = metrics.values;
-        for (const key in ref) {
-          const value = ref[key];
-          const subTaskIndex = key.replace('.currentInputWatermark', '');
-          watermarks[subTaskIndex] = value;
-          if (isNaN(minValue) || value < minValue) {
-            minValue = value;
+  getWatermarks(jobId: string, vertexId: string) {
+    return this.httpClient
+      .get<Array<{ id: string; value: string }>>(
+        `${BASE_URL}/jobs/${jobId}/vertices/${vertexId}/watermarks`
+      )
+      .pipe(
+        map(arr => {
+          let minValue = NaN;
+          let lowWatermark = NaN;
+          const watermarks: { [id: string]: number } = {};
+          arr.forEach(item => {
+            const value = parseInt(item.value, 10);
 
 Review comment:
   is it a desire to drop the decimal here, if not I suggest to use 
`+item.value`
   ```suggestion
               const value = +item.value;
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to