-
Notifications
You must be signed in to change notification settings - Fork 4.5k
BEAM-3803: Dataflow runner implements metrics contract #4841
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
Conversation
|
Strong agreement. If you have committed metrics, that number is clearly within spec for attempted metrics (which can be pretty much any value at all, when you get down to it). |
| public T committed() { | ||
| T committed = committedInternal(); | ||
| if (committed == null) { | ||
| throw new UnsupportedOperationException("This runner does not currently support committed" |
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'm not so keen on the use of exception instead of null. If something is explicitly optional @Nullable seems reasonable (insert standard rant about how Optional is a better choice but Java screwed it up and Guava is shaded).
I would imagine that changes to this class would just remove @Nullable from attempted, then an additional static factory method like createCommitted(<just committed value>) that populates both fields with that value, createAttempted(<just attempted value>) that leaves committed null and create(<both not nullable>). Incidentally the existing create method seems broken as it fails to mark them as @Nullable. When we plug in the checker framework that should be caught.
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 see - the javadoc tells you to do this. That sucks. Want to fix the javadoc to have this better spec?
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.
OK let's just make Dataflow match the spec and later change the spec to be good.
|
run java precommit |
1 similar comment
|
run java precommit |
|
run java gradle precommit |
|
run java precommit |
Attempted metrics are not optional, they should always be returned. Committed metrics are a close enough approximation for attempted. When attempted metrics are not supported, a
UnsupportedOperationExceptionshould be thrown rather then returning null. See:beam/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricResult.java
Line 42 in 3c73170
Follow this checklist to help us incorporate your contribution quickly and easily:
[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue.mvn clean verifyto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.