You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by wangtuo21 <gi...@git.apache.org> on 2018/05/19 17:23:06 UTC
[GitHub] flink pull request #6047: [FLINK-8160]Extend OperatorHarness to expose...
GitHub user wangtuo21 opened a pull request:
https://github.com/apache/flink/pull/6047
[FLINK-8160]Extend OperatorHarness to expose...
...metricsGroup
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/wangtuo21/flink master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6047.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 #6047
----
commit 997e87b419c73643e93e74b96a350865e4ec64b0
Author: wangtuo21 <37...@...>
Date: 2018-05-19T17:20:49Z
[FLINK-8160]Extend OperatorHarness to expose...
...metricsGroup
----
---
[GitHub] flink issue #6047: [FLINK-8160]Extend OperatorHarness to expose...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/6047
Please explain how this solution allows the user of a `AbstractStreamOperatorTestHarness to access the metrics registered by contained operator.
---
[GitHub] flink issue #6047: [FLINK-8160]Extend OperatorHarness to expose...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/6047
No, this still doesn't work.
The MetricGroup you're trying to expose is created in `AbstractStreamOperator#setup`. However, the parent MetricGroup retrieved through `Environment#getMetricGroup` is null since this method is never mocked for the `MockEnvironment` in `AbstractStreamOperatorTestHarness`. Thus, in `AbstractStreamOperator#setup` we're entering the fail-safe block which creates a dummy `MetricGroup` that never stores anything.
As such no metric can actually be retrieved from the `MetricGroup`.
Please, ask questions if you don't know to fix an issue, or hot verify the fix. And at the very least try it out _once_, otherwise you're just wasting the committers' time.
For a proper solution you have to create a `TaskMetricGroup` in the `AbstractStreamOperatorTestHarness`, which you then use in the `MockEnvironment` by returning it from `Environment#getMetricGroup`
With this scheme however metrics are only available while the task hasn't been closed (as metrics are cleaned up), so for better usability your `TaskMetricGroup` must override `TaskMetricGroup#getOperator` to return a special `OperatorMetricGroup` that also stores registered metrics in the `AbstractStreamOperatorTestHarness`. We do not store them indefinitely in the `OperatorMetricGroup` since that would change one of the core behaviors of the `MetricGroup`. Finally, add a `getMetrics` method to the `AbstractStreamOperatorTestHarness` to actually access registered metrics.
---
[GitHub] flink issue #6047: [FLINK-8160]Extend OperatorHarness to expose...
Posted by wangtuo21 <gi...@git.apache.org>.
Github user wangtuo21 commented on the issue:
https://github.com/apache/flink/pull/6047
@zentol , I misunderstood the request. Does it go in the right direction now? Thank you
---
[GitHub] flink pull request #6047: [FLINK-8160]Extend OperatorHarness to expose...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/flink/pull/6047
---