[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351963262
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351963949
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
 
 Review comment:
   ```suggestion
   ```
   lowWatermark is no longer needed here


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351963262
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351962703
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351963149
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351962827
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351962926
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 return { ...node, lowWatermark };
 
 Review comment:
   ```suggestion
   return { ...node, lowWatermark: result.lowWatermark };
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351962827
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351960228
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 
 Review comment:
   miss 'semicolon' here
   ```suggestion
   lowWatermark = result.lowWatermark;
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351962703
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
 
 Review comment:
   ```suggestion
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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_r351960228
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/job/overview/job-overview.component.ts
 ##
 @@ -66,28 +65,10 @@ export class JobOverviewComponent implements OnInit, 
OnDestroy {
   mergeWithWatermarks(nodes: NodesItemCorrectInterface[]): 
Observable {
 return forkJoin(
   nodes.map(node => {
-const listOfMetricId = [];
 let lowWatermark = NaN;
-for (let i = 0; i < node.parallelism; i++) {
-  listOfMetricId.push(`${i}.currentInputWatermark`);
-}
-return this.metricService.getMetrics(this.jobId, node.id, 
listOfMetricId).pipe(
-  map(metrics => {
-let minValue = NaN;
-const watermarks: { [index: string]: number } = {};
-for (const key in metrics.values) {
-  const value = metrics.values[key];
-  const subtaskIndex = key.replace('.currentInputWatermark', '');
-  watermarks[subtaskIndex] = value;
-  if (isNaN(minValue) || value < minValue) {
-minValue = value;
-  }
-}
-if (!isNaN(minValue) && minValue > LONG_MIN_VALUE) {
-  lowWatermark = minValue;
-} else {
-  lowWatermark = NaN;
-}
+return this.metricService.getWatermarks(this.jobId, node.id).pipe(
+  map(result => {
+lowWatermark = result.lowWatermark
 
 Review comment:
   miss 'semicolon' here
   ```suggestion
   lowWatermark = result.lowWatermark;
   ```


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


[GitHub] [flink] vthinkxie commented on a change in pull request #10238: [FLINK-8949] Add dedicated watermarks metric retrieval endpoint

2019-11-28 Thread GitBox
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>(
+`${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