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

Add ability to encode and decode histogram data to portable runners #33013

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

Naireen
Copy link
Contributor

@Naireen Naireen commented Nov 5, 2024

Add ability to encode and decode histogram data to portable runners

#33090


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.

@Naireen Naireen force-pushed the add_hist_to_runner_implementation branch 4 times, most recently from 3a39975 to 3d01bec Compare November 5, 2024 19:33
@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_Hadoop_IO_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_GCP_IO_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 5, 2024

Run Java_IOs_Direct PreCommit

@Naireen Naireen force-pushed the add_hist_to_runner_implementation branch from 3d01bec to 4f8b923 Compare November 6, 2024 04:41
@Naireen
Copy link
Contributor Author

Naireen commented Nov 6, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 6, 2024

Run Java PreCommit

1 similar comment
@Naireen
Copy link
Contributor Author

Naireen commented Nov 6, 2024

Run Java PreCommit

@Naireen Naireen marked this pull request as ready for review November 6, 2024 18:57
Copy link
Contributor

github-actions bot commented Nov 6, 2024

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

@Naireen
Copy link
Contributor Author

Naireen commented Nov 6, 2024

assign set of reviewers

Copy link
Contributor

github-actions bot commented Nov 6, 2024

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @m-trieu for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@Naireen Naireen force-pushed the add_hist_to_runner_implementation branch 2 times, most recently from 11a08fa to 25a7cfd Compare November 11, 2024 21:25
@Naireen
Copy link
Contributor Author

Naireen commented Nov 11, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 12, 2024

Run Java PreCommit

1 similar comment
@Naireen
Copy link
Contributor Author

Naireen commented Nov 12, 2024

Run Java PreCommit

Naireen added 2 commits November 12, 2024 20:27
add ability to encode and decode histogram data to portable runners
@Naireen Naireen force-pushed the add_hist_to_runner_implementation branch from c9b7345 to 24ce41c Compare November 12, 2024 20:27
base2Exp.setScale(buckets.getScale());
outputHistogram2.setBucketOptions(new BucketOptions().setExponential(base2Exp));
} else {
throw new RuntimeException("Unable to parse histogram, bucket is not recognized");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we throw a more specific exception here?

It can extend RuntimeException but will help with debugging

Copy link
Contributor

Choose a reason for hiding this comment

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

Also what does the caller do if an exception is thrown?

Do we want to LOG the error and return Optional if we don't care about the exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, returned a custom error message


return ByteString.copyFromUtf8(jsonString);
} catch (Exception e) {
throw new RuntimeException(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto above

Can we throw a more specific exception here?

It can extend RuntimeException but will help with debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clarify, when encoding and decoding, if there are specific errors like the format isn't as expected (or if the bucket isn't supported), I raise the HistogramParsingException error, and then have the generic

catch (IOException e) {
throw new RuntimeException(e);

at the end that is a part of all encoding and decodings.

base2Exp.setScale(expNode.get("scale").asInt());
newHist.setBucketOptions(new BucketOptions().setExponential(base2Exp));
} else {
throw new RuntimeException("Unable to parse histogram, bucket is not recognized");
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto above

Can we throw a more specific exception here?

It can extend RuntimeException but will help with debugging

Copy link
Contributor

Choose a reason for hiding this comment

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

Also what does the caller do if an exception is thrown?

Do we want to LOG the error and return Optional if we don't care about the exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the existing style, where it throws an error. Essentially nothing happens if an error is thrown (the call is here, where we dont actaully return anything:

private void updateForLatestInt64Type(MonitoringInfo monitoringInfo) {
) This is separate than the data processing path, so if there is an error in the metrics processing, its not retried.
We can update this to return an optional for all the decoders instead if we want, but that should likely be a separate change and should ve done for all of them at once

base2Exp.setScale(buckets.getScale());
outputHistogram2.setBucketOptions(new BucketOptions().setExponential(base2Exp));
} else {
throw new RuntimeException("Unable to parse histogram, bucket is not recognized");
Copy link
Contributor

Choose a reason for hiding this comment

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

Also what does the caller do if an exception is thrown?

Do we want to LOG the error and return Optional if we don't care about the exception?

@Naireen Naireen force-pushed the add_hist_to_runner_implementation branch from 37ffd60 to c9d4de9 Compare November 14, 2024 17:40
@Naireen
Copy link
Contributor Author

Naireen commented Nov 14, 2024

Run Java_IOs_Direct PreCommit

@Naireen
Copy link
Contributor Author

Naireen commented Nov 14, 2024

Run Java PreCommit

1 similar comment
@Naireen
Copy link
Contributor Author

Naireen commented Nov 14, 2024

Run Java PreCommit

Copy link
Contributor

@m-trieu m-trieu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

R: @robertwb for final approval

@johnjcasey johnjcasey merged commit 5bfacc9 into apache:master Nov 15, 2024
34 checks passed
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.

3 participants