beam icon indicating copy to clipboard operation
beam copied to clipboard

Backlog metrics do not showing up in FlinkRunner

Open talatuyarer opened this issue 1 year ago • 2 comments

We have a Flink Job which does not emit backlog metrics. Actually metrics are emitting in KafkaIO. However I could not see them on Flink Metric system. Looks like Beam -> Flink wiring is broken. I set metricContext in Checkpointing phase which is the place metrics emit on UnBoundedReader.

I see previous PR is closed. I recreated against latest master

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • [ ] Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • [ ] Update CHANGES.md with noteworthy changes.
  • [ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels Python tests Java tests Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

talatuyarer avatar Dec 17 '23 00:12 talatuyarer

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

github-actions[bot] avatar Dec 18 '23 00:12 github-actions[bot]

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Feb 16 '24 12:02 github-actions[bot]

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

github-actions[bot] avatar Feb 24 '24 12:02 github-actions[bot]

R: @je-ik

je-ik avatar Jun 06 '24 06:06 je-ik

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

github-actions[bot] avatar Jun 06 '24 06:06 github-actions[bot]

There was a significant change in https://github.com/apache/beam/pull/25525 that affects this. The ReaderInvocationUtil#invokeCheckpoint must be used in FlinkUnboundedSourceReader#getReaderCheckpoint as well. For this functionality to be preserved during refactorings, it would be nice to add at least a basic test to verify it works (which would prove it will not - at least for classic runner - in this case, because of the missing use in FlinkUnboundedSourceReader. The UnboudedSourceWrapper should be removed as drafted in https://github.com/apache/beam/pull/31530.

In the original PR there was a suspicion that this causes some issues, is this resolved?

je-ik avatar Jun 06 '24 08:06 je-ik

Re-adding my comment from the original PR here since this one is now open.

I am facing a similar issue while using JdbcIO, I can't see the metrics that are emitted in the Flink Metric system. Do the changes here fix the issue, or are there other changes that need to be made for sources/sinks that are not UnboundedSources?

I am using the apache beam version 2.56.0 and beam-runners-flink-1.17

oswidan97 avatar Jun 06 '24 15:06 oswidan97

You don't see any metrics, or metrics related to checkpoints?

je-ik avatar Jun 06 '24 15:06 je-ik

You don't see any metrics, or metrics related to checkpoints?

I am referring specifically to these 2 metrics, the value is always NaN even though data is being ingested in the sink database that I am using

image

oswidan97 avatar Jun 06 '24 16:06 oswidan97

@je-ik Because Metrics are creating when Flink's open function but because they are not getting update at advance time. Flink does not receive updated metrics. My code change make metrics update part of checkpointing time. We are using this fix with 30K+ Flink jobs and build a autoscaling for Beam. https://beam.apache.org/blog/apache-beam-flink-and-kubernetes-part3/

talatuyarer avatar Jun 06 '24 17:06 talatuyarer

@je-ik Because Metrics are creating when Flink's open function but because they are not getting update at advance time. Flink does not receive updated metrics. My code change make metrics update part of checkpointing time. We are using this fix with 30K+ Flink jobs and build a autoscaling for Beam. https://beam.apache.org/blog/apache-beam-flink-and-kubernetes-part3/

Yes, I understand that. I'm a little struggling why @oswidan97 does not see any metrics in his case. Might be because he is apparently using bounded reader. On the other hand, the patch in this PR affects only portable runner, so I suppose for your autoscaling case you use the portable one, right?

je-ik avatar Jun 07 '24 07:06 je-ik

@je-ik Because Metrics are creating when Flink's open function but because they are not getting update at advance time. Flink does not receive updated metrics. My code change make metrics update part of checkpointing time. We are using this fix with 30K+ Flink jobs and build a autoscaling for Beam. https://beam.apache.org/blog/apache-beam-flink-and-kubernetes-part3/

Yes, I understand that. I'm a little struggling why @oswidan97 does not see any metrics in his case. Might be because he is apparently using bounded reader. On the other hand, the patch in this PR affects only portable runner, so I suppose for your autoscaling case you use the portable one, right?

No, I see the confusion. @oswidan97 refers to sink not source. Can you please create different issue for that? This seems unrelated to this issue, because this one is about source metrics.

je-ik avatar Jun 07 '24 07:06 je-ik

New issue created here, for reference

oswidan97 avatar Jun 07 '24 11:06 oswidan97

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Aug 06 '24 12:08 github-actions[bot]

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

github-actions[bot] avatar Aug 13 '24 12:08 github-actions[bot]