Skip to content

[BEAM-11994] Add HarnessMonitoringInfosRequest/Response InstructionRequest and MonitoringInfosMetadataRequest/Response support to Java SDK.#14805

Merged
pabloem merged 1 commit intoapache:masterfrom
ajamato:bq_metrics_process_wide_process_wide
Jul 2, 2021
Merged

Conversation

@ajamato
Copy link
Copy Markdown

@ajamato ajamato commented May 13, 2021

[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:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status Build Status Build Status --- Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@ajamato
Copy link
Copy Markdown
Author

ajamato commented May 13, 2021

R: @robertwb @pabloem

Split from
#14490

@aaltay
Copy link
Copy Markdown
Member

aaltay commented May 27, 2021

@robertwb @pabloem: Would you be able to review this?

@ajamato
Copy link
Copy Markdown
Author

ajamato commented May 28, 2021

Not waiting for review, discussed offline. Need to make some changes. Will get to it in in about 3 weeks.

@ajamato ajamato force-pushed the bq_metrics_process_wide_process_wide branch 4 times, most recently from bbe509f to 2933b02 Compare June 15, 2021 20:18
@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 16, 2021

R: @robertwb R: @pabloem

Hi, lets pick up this review again. I removed all reference to startTimes, no longer using these on the MonitoringInfo.

@pabloem
Copy link
Copy Markdown
Member

pabloem commented Jun 18, 2021

LGTM.

@robertwb any comments?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is not being bound to a step equivalent to being process wide?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No. its not equivalent. We have these in a some other places I believe.

It was used here as well

private MetricsContainerImpl unboundContainer = new MetricsContainerImpl(null);

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added MetricsContainerImpl.createProcessWideContainer()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remind me why MetricsEnvironment needs a setter rather than it just implicitly always creating one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, I agree a refactor seems out of scope for this PR.

@ajamato ajamato force-pushed the bq_metrics_process_wide_process_wide branch 2 times, most recently from 9988de8 to 02a40a3 Compare June 21, 2021 22:03
@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 22, 2021

Run Java PreCommit

@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 22, 2021

Precommit is flakey, but lets not let that block the review at the moment

@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 23, 2021

Run Java PreCommit

@aaltay
Copy link
Copy Markdown
Member

aaltay commented Jun 29, 2021

All tests are passing. Is this ready to be merged?

…quest and MonitoringInfosMetadataRequest/Response support to Java SDK.
@ajamato ajamato force-pushed the bq_metrics_process_wide_process_wide branch from 02a40a3 to 48ad919 Compare June 30, 2021 01:39
@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 30, 2021

Run Java PreCommit

@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jun 30, 2021

Run Java_Examples_Dataflow PreCommit

@ajamato
Copy link
Copy Markdown
Author

ajamato commented Jul 2, 2021

Thanks @aaltay @robertwb
Would you please merge?

@pabloem pabloem merged commit a60aeba into apache:master Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants