[BEAM-11994] Add HarnessMonitoringInfosRequest/Response InstructionRequest and MonitoringInfosMetadataRequest/Response support to Java SDK.#14805
Conversation
e2fb2f2 to
3c89635
Compare
|
Not waiting for review, discussed offline. Need to make some changes. Will get to it in in about 3 weeks. |
bbe509f to
2933b02
Compare
|
LGTM. @robertwb any comments? |
There was a problem hiding this comment.
Is not being bound to a step equivalent to being process wide?
There was a problem hiding this comment.
No. its not equivalent. We have these in a some other places I believe.
It was used here as well
I believe this was added for some metrics which had the step already in the label information already. (In some code which was tracking metrics for multiple steps). So there was no need to have the container know about the step name.
Likely one of the system metrics. ElementCount, ExecutionTime, etc.
If you feel this needs to be changed, please pick a specific option and I will introduce it. One I can think of is:
adding static factory method (which will set the step to null and isProcessWide to true):
public static MetricsContainerImpl createProcessWideContainer();
There was a problem hiding this comment.
It feels like that if MetricContainer[Impls] are only sometimes associated with steps, the step association should be stored elsewhere, not as part of this instance. But maybe that's too big a refactoring for now.
+1 to MetricsContainerImpl.createProcessWideContainer(); the nullary constructor doesn't make it obvious the intent is to have this process-wide.
There was a problem hiding this comment.
Added MetricsContainerImpl.createProcessWideContainer()
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Is the only use of this to prevent it from being reset? (Which, presumably, would be easy to accidentally do?) If so, can we make this private (or just access the member directly) and remove the addition to the interface?
There was a problem hiding this comment.
Done. Made it private
(Yes. Previously there was a PR which had called reset() on it which caused some debugging issued when adding this cl.)
There was a problem hiding this comment.
Remind me why MetricsEnvironment needs a setter rather than it just implicitly always creating one.
There was a problem hiding this comment.
The main reason was to allow clearing/cleaning the state between tests.
Explicitly creating it forces you to create a clean state on startup.
We could have had one here by default as well. I don't feel too strongly here.
Though I would consider it out of scope of this PR
There was a problem hiding this comment.
My preference is to have the tests be non-idiomatic (e.g. you could have a reset-process-container-for-test method) than have the "production" code be non-idiomatic to accommodate tests. Having a setter doesn't prevent state from leaking from test to test (though I guess it forces you to set it in at least one test).
There was a problem hiding this comment.
Okay, I looked into this a bit more. And I don't think that I can set the MetricContainerInmpl as the default container in MetricsEnvironment without adding a bad dependency, which I think may introduce a cycle.
As intellij seems to want to add the dependency when I try to instantiate the MetricsContainerImpl in MetricsEnvironment.
I dont think we can add a dep in this direction. (Today, MetricsEnvironment only depends on the interface MetricsContainer).
sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
That is, we don't make the sdk/java/core depend on the runners/core-java.
The way it works today is because we allow sdks/java/harness to depend on runners/core-java.
which is why we can instantiate it in
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnHarness.java
Some larger refactor may make this possible, but I feel its unclear what would be the best choice here and would be too big a refactor for this PR
There was a problem hiding this comment.
OK, I agree a refactor seems out of scope for this PR.
9988de8 to
02a40a3
Compare
|
Run Java PreCommit |
|
Precommit is flakey, but lets not let that block the review at the moment |
|
Run Java PreCommit |
|
All tests are passing. Is this ready to be merged? |
…quest and MonitoringInfosMetadataRequest/Response support to Java SDK.
02a40a3 to
48ad919
Compare
|
Run Java PreCommit |
|
Run Java_Examples_Dataflow PreCommit |
[BEAM-11994] Add HarnessMonitoringInfosRequest/Response InstructionRequest and MonitoringInfosMetadataRequest/Response support to Java SDK.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
ValidatesRunnercompliance status (on master branch)Examples testing status on various runners
Post-Commit SDK/Transform Integration Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.