[ https://issues.apache.org/jira/browse/FLINK-7781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16218372#comment-16218372 ]
ASF GitHub Bot commented on FLINK-7781: --------------------------------------- GitHub user zentol opened a pull request: https://github.com/apache/flink/pull/4901 [FLINK-7781][metrics][REST] Support on-demand aggregations ## What is the purpose of the change This PR adds on-demand aggregation support to the metrics REST API. It allows aggregating * taskmanagers metrics across all taskmanagers * job metrics across all jobs * subtask metrics across all subtasks The aggregation is handled by new handlers as described in the documentation. Additionally, a subtask metric handler was added to subsume the existing JobVertexMetricsHandler to expose subtask metrics in a more idiomatic way. The JobVertexMetricsHandler was not removed for backwards compatibility (with the webUI in particular): ## Brief change log * fix the requests examples in the metric handler javadocs * implement aggregation handlers * expose all subtask stores in TaskMetricStore for easier access * extend MetricStoreTest#setupMetricStore to contain metrics for multiple entities * integrate aggregation handlers into WebRuntimeMonitor * document the metrics REST API ## Verifying this change This change added tests for each Aggregating*MetricsHandler and for the abstract base class (AbstractAggregatingMetricsHandlerTest). This change can be verified manually by running multiple taskmanagers/jobs/subtasks in the cluster and querying the rest endpoints as described in the documentation. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no) - The serializers: (no) - The runtime per-record code paths (performance sensitive): (no) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no) ## Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (docs) You can merge this pull request into a Git repository by running: $ git pull https://github.com/zentol/flink 7781 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4901.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4901 ---- commit 4a3f51157180241210160fb73508f406c9192bc2 Author: zentol <ches...@apache.org> Date: 2017-10-25T07:42:14Z [hotfix][javadocs] Fix metric handler example javadocs commit afabf6fb72c2b2bd94fb0410c985e61e940d138e Author: zentol <ches...@apache.org> Date: 2017-10-25T09:21:28Z [FLINK-7781][metrics][REST] Support on-demand aggregations commit f768be1ebe0059b30571c43950f0942a7919bb0c Author: zentol <ches...@apache.org> Date: 2017-10-25T09:21:46Z [FLINK-7912][metrics][docs] Document metrics REST API ---- > Support simple on-demand metrics aggregation > -------------------------------------------- > > Key: FLINK-7781 > URL: https://issues.apache.org/jira/browse/FLINK-7781 > Project: Flink > Issue Type: Improvement > Components: Metrics, REST > Affects Versions: 1.4.0 > Reporter: Chesnay Schepler > Assignee: Chesnay Schepler > Fix For: 1.4.0 > > > We should support aggregations (min, max, avg, sum) of metrics in the REST > API. This is primarily about aggregating across subtasks, for example the > number of incoming records across all subtasks. > This is useful for simple use-cases where a dedicated metrics backend is > overkill, and will allow us to provide better metrics in the web UI (since we > can expose these aggregated as well). > I propose to add a new query parameter "agg=[min,max,avg,sum]". As a start > this parameter should only be used for task metrics. (This is simply the main > use-case i have in mind) > The aggregation should (naturally) only work for numeric metrics. > We will need a HashSet of metrics that exist for subtasks of a given tasks > that has to be updated in {{MetricStore#add}}. > All task metrics are either stored as > # {{<subtask-index>.<metric>}} or > # {{<subtask-index>.<operator-name>.<metric>}}. > If a user sends a request {{get=mymetric,agg=sum}}, only the metrics of the > first kind are to be considered. Similarly, given a request > {{get=myoperator.mymetric,agg=sum}} only metrics of the second kind are to be > considered. > Ideally, the name of the aggregated metric (i.e. the original name without > subtask index) is also contained in the list of available metrics. -- This message was sent by Atlassian JIRA (v6.4.14#64029)