You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by zentol <gi...@git.apache.org> on 2017/11/29 13:00:10 UTC
[GitHub] flink pull request #5100: [FLINK-4812][metrics] Expose currentLowWatermark f...
GitHub user zentol opened a pull request:
https://github.com/apache/flink/pull/5100
[FLINK-4812][metrics] Expose currentLowWatermark for all operators
This is an alternative version of #5092.
## What is the purpose of the change
This PR makes all operators expose the current input/output watermark through the metric system.
Generally, watermarks are measured separately; input watermarks are measured in `AbstractStreamOperator#processWatermark(Watermark)` and output are measured in the `Output` of the respective operator.
Sub-classes may specify to expose the same watermark as input/output by overriding `AbstractStreamOperator#useSeparateWatermarkGauges`, which is used for sources, sink and watermark assigners.
## Brief change log
* remove watermark metric logic from `Stream[Two]InputProcessor`
* this implies that this metric is no longer measured at the task level at all
* introduce `WatermarkGauge` class to decouple metric from local state of operator classes (i.e. some currentLowWatermark field)
* setup `WatermarkGauge`s in `AbstractStreamOperator#setup`
* introduce `AbstractStreamOperator#useSeparateWatermarkGauges` to control re-use behavior
* measure the input watermark received by operators in
* `AbstractStreamOperator#processWatermark`
* `AsyncWaitOperator#processWatermark`
* `ContinuousFileReaderOperator#processWatermark`
* measure the output watermark emitted by operators in the `Output`
* rename `CountingOutput` to `OutputWithMetrics`
* update metrics reference in the documentation
## Verifying this change
This change modified the following tests:
* `TimestampsAndPunctuatedWatermarksOperatorTest#testTimestampsAndPeriodicWatermarksOperator`
* `TimestampsAndPeriodicWatermarksOperatorTest#testTimestampsAndPeriodicWatermarksOperator`
* `AsyncWaitOperatorTest#testEventTime`
This change added the following tests:
* `WatermarkGaugeTest`
* `StreamOperatorWatermarkMetricsTest`
* `StreamSourceOperatorTest#testWatermarkMetrics`
* `StreamSinkOperatorTest#testWatermarkMetrics`
## 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): (**yes**)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not applicable)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zentol/flink 4812b
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/5100.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 #5100
----
commit 6bbc92d248fe3b7f50025c49dc38f0e8cb2b7883
Author: zentol <ch...@apache.org>
Date: 2017-11-29T11:46:59Z
[FLINK-4812][metrics] Expose currentLowWatermark for all operators
----
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
You can't measure input metrics in the ChainingOutput (nicely) since for a chain A->B does B at no point have access to the output of A.
We would need to have the task setup all watermark metrics and either pass them on to operators for registration or have the task register them for operators, which is just backwards. This also clashes heavily with the idea of operators deciding whether the same metric is used for input&output.
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
yes, we _could_ setup all IO metrics in the operator chain. But that will require some more changes there since the methods there never access 2 operators at the same time.
For a chain A->B, to setup the output of A you need metrics for both A and B.
You cannot be "clever" and re-use the output metrics of A as the input metrics for B, since this will cause odd results in forking chain scenarios where the input metrics for both chained operators change at the same time even though they are always processed sequentially. This would get even more funky if an operator decides that it's input/output metrics are always supposed to be identical, at which point you have metrics for 3 operators changing at the same time.
But just thinking about modifying the `OperatorChain` sends shivers down my spine ❄️
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on the issue:
https://github.com/apache/flink/pull/5100
I think the fact the the operator needs this in `setup()` is already problematic, the latency metrics implementation shouldn't have been merged like this. Wouldn't we need the output gauge only in `OperatorChain` because that creates the `Output`s that operators use to emit watermarks?
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
the coupling of input to output gauge becomes rather tricky. The input gauge must be reachable in `Stream[Two]InputProcessor`, `OperatorChain#createChainedOperator`, and the output gauge in `AbstractStreamOperator#setup`.
For sources, sinks and watermark assigners we must refer to the same gauge in both places. I don't see how we can do this in a nice way.
The rather nice thing the current approach has is that everything is contained in `AbstractStreamOperator` and isn't scattered all over the place.
`Given that we allow people to completely re-define how operators handle watermarks, wouldn't it make sense to give them the same freedom when it comes to the input watermark metrics?
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
ah, weÄ#re doing the same already for `numRecordsIn`.... maybe we can do this after all.
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
input processors only exist once per task, no? So we wouldn't measure them at the operator level.
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on the issue:
https://github.com/apache/flink/pull/5100
Ah stupid, so we have to do it in the chain and in the input processors. Because the problem of operators overriding `processWatermark()` is real. 😅
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on the issue:
https://github.com/apache/flink/pull/5100
Could we set the watermark in the stream input processors (for the input watermark). Operators might override `processWatermark`, and in fact `AsyncWaitOperator` does that and doesn't call the `super`.
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
Closing due to revised approach showcased in #5125.
---
[GitHub] flink issue #5100: [FLINK-4812][metrics] Expose currentLowWatermark for all ...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5100
@tzulitai @aljoscha
---
[GitHub] flink pull request #5100: [FLINK-4812][metrics] Expose currentLowWatermark f...
Posted by zentol <gi...@git.apache.org>.
Github user zentol closed the pull request at:
https://github.com/apache/flink/pull/5100
---