-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add ability to encode and decode histogram data to portable runners #33013
Conversation
3a39975
to
3d01bec
Compare
Run Java_IOs_Direct PreCommit |
Run Java_Hadoop_IO_Direct PreCommit |
Run Java PreCommit |
Run Java_IOs_Direct PreCommit |
Run Java_GCP_IO_Direct PreCommit |
Run Java_IOs_Direct PreCommit |
Run Java PreCommit |
Run Java_IOs_Direct PreCommit |
3d01bec
to
4f8b923
Compare
Run Java_IOs_Direct PreCommit |
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
assign set of reviewers |
Assigning reviewers. If you would like to opt out of this review, comment R: @m-trieu for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
11a08fa
to
25a7cfd
Compare
Run Java_IOs_Direct PreCommit |
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
...rs/core-java/src/main/java/org/apache/beam/runners/core/metrics/MonitoringInfoEncodings.java
Outdated
Show resolved
Hide resolved
0982a45
to
c9b7345
Compare
add ability to encode and decode histogram data to portable runners
c9b7345
to
24ce41c
Compare
base2Exp.setScale(buckets.getScale()); | ||
outputHistogram2.setBucketOptions(new BucketOptions().setExponential(base2Exp)); | ||
} else { | ||
throw new RuntimeException("Unable to parse histogram, bucket is not recognized"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
beam/runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
Line 518 in f38edb7
private void updateForLatestInt64Type(MonitoringInfo monitoringInfo) { |
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"); |
There was a problem hiding this comment.
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?
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java
Outdated
Show resolved
Hide resolved
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java
Show resolved
Hide resolved
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java
Show resolved
Hide resolved
37ffd60
to
c9d4de9
Compare
Run Java_IOs_Direct PreCommit |
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
R: @robertwb for final approval |
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:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.