Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a handful of perworkermetrics the bigquery sink (#28903). #29098

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

JayajP
Copy link
Contributor

@JayajP JayajP commented Oct 20, 2023

Implement the following set of metrics in BigQuery's StorageWriteAPI transforms. These metrics will be stored in the PerWorkerMetrics container defined in (#28923)

1. AppendRowsRowStatus Counter

Metric that tracks the status of BigQuery rows after making an AppendRows RPC call.

  • If the AppendRows RPC succeeds, it tracks the number of rows that been successfully scheduled for a flush.
  • If the AppendRows RPC fails, it tracks the number of rows that will be retried and failed.

Metric has labels the following labels:

  • RowStatus: Status of the BigQuery rows after , one of SUCCESSFUL, RETRIED, FAILED
  • Status: gRPC status of the AppendRows RPC
  • TableId: 'datasets/{ }/tables/{ }' that the rows are sent to.

2. ThrottledTime Counter

Tracks the total time spent waiting between RPC retries.

Metric has labels the following labels:

  • Method: BigQuery method that's causing the throttle. One of AppendRows, FlushRows, FinalizeStream.

3. RpcRequests Counter

Tracks the Rpc Status of various BigQuery write methods.

Metric has labels the following labels:

  • Method: BigQuery sink method. One of AppendRows, FlushRows, FinalizeStream.
  • Status: gRPC status of the RPC
  • TableId: 'datasets/{ }/tables/{ }' that the rows are sent to.

4. RpcLatency Histogram:

Tracks the Rpc Latency of various BigQuery write methods.

Metric has labels the following labels:

  • Method: BigQuery sink method. One of AppendRows, FlushRows, FinalizeStream.

Notes

  • We pass a Counter to FluentBackoff.java which tracks the total time spent backing off aka ThrottleTime.

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.

@github-actions
Copy link
Contributor

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

@@ -643,11 +650,20 @@ long flush(
contexts -> {
AppendRowsContext failedContext =
Preconditions.checkStateNotNull(Iterables.getFirst(contexts, null));
Instant operationEndTime = Instant.now();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this pattern all over the place, of grabbing the start time, updating a metric, grabbing error code, etc.

Is it possible to repackage this into a reusable utility method for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repacked updating the RpcRequests and RpcLatency metrics into utility methods since that are reused across all write methods. These updates are now handled by reportSuccessfulRpcMetrics and reportFailedRPCMetrics.

It's not straightforward to refactor updates AppendRowsRowStatus into a utility. When we update this metric we need to know the number of rows that were failed/retried/succeeded so it's more embedded in the code.

@JayajP JayajP requested a review from johnjcasey November 8, 2023 19:52
@johnjcasey
Copy link
Contributor

This LGTM. I'm rerunning the tests before merge however.

@johnjcasey
Copy link
Contributor

Retest this please

@johnjcasey
Copy link
Contributor

That test failure is a flake, this is good to go!

@johnjcasey johnjcasey merged commit 2012107 into apache:master Nov 15, 2023
34 of 35 checks passed
@JayajP
Copy link
Contributor Author

JayajP commented Nov 15, 2023

There's a single jenkins test failure but the corresponding Github actions for that test passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants