Skip to content

[BEAM-6181] Reporting user counters via MonitoringInfos in Portable Dataflow Runner. - #7202

Merged
swegner merged 7 commits into
apache:masterfrom
Ardagan:WorkerMetrics3
Dec 7, 2018
Merged

swegner merged 7 commits into
apache:masterfrom
Ardagan:WorkerMetrics3

Conversation

@Ardagan

@Ardagan Ardagan commented Dec 4, 2018

Copy link
Copy Markdown
Contributor

Plumb user metrics through Portable Dataflow Runner.

Some constants are defined in code that later should be later changed to values defined in this pr.

Code only supports User counters. Other types of counters will be added in another PRs.

Added component level tests. Unittests require more refactoring that will hide the essense of this change.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • 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.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

It will help us expedite review of your Pull Request if you tag someone (e.g. @username) to look at it.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java 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 --- --- ---

@Ardagan
Ardagan force-pushed the WorkerMetrics3 branch 2 times, most recently from 8cee084 to 53990c0 Compare December 5, 2018 00:04
@Ardagan

Ardagan commented Dec 5, 2018

Copy link
Copy Markdown
Contributor Author

@ajamato Please review.

@Ardagan

Ardagan commented Dec 5, 2018 •

Copy link
Copy Markdown
Contributor Author

@swegner (committer)

// todo: run MonitoringInfo through validation process.
// refer to https://github.com/apache/beam/pull/6799

if (urn.startsWith(BEAM_METRICS_USER_PREFIX)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Architectural suggestion would be to use polymorphism instead of a switch statement,

Make a class/object responsible for each URN.

Though I think much of it can be common, like label extraction/conversion. Let's come up with something that will support some default behaviour and allow you to override it with specific URN needs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree with this one.
I decided to keep it this way for now. Will implement polymorphism when adding support for another counter type.

.setOriginNamespace(counterNamespace))
.setMetadata(new CounterMetadata().setKind("SUM"));

return new CounterUpdate()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is okay for now, since you are just unpacking the user counter metric. but I want to see this share more code for different metrics later on.

Any label extraction can be shared for example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That is a valid point. But I'd prefer to implement this in next PR when I add other type of counters.

this.transformIdMapping = transformIdMapping;
}

// todo: search code for "beam:metrics"... and replace them with relevant enums from

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.

Should this be fixed before merging?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This depends on #6799
Will be implemented in further PRs.


String type = monitoringInfo.getType();

// todomigryz: run MonitoringInfo through validation process.

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.

Should this be fixed before merging?

@Ardagan Ardagan Dec 6, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This requires PR mentioned on next line to go in. (#6799)
Technically, I can copy data from another PR, but format of counters is still being defined. It will cause more merging and resolving in both PRs as well.
I suggest we keep it as is for this PR and generalize/fix it in following PR.

@swegner

swegner commented Dec 6, 2018

Copy link
Copy Markdown
Contributor

LGTM, will squash and merge.

@swegner

swegner commented Dec 6, 2018

Copy link
Copy Markdown
Contributor

Pre-commits before my fixup are green:

image

@Ardagan

Ardagan commented Dec 6, 2018

Copy link
Copy Markdown
Contributor Author

Thank you Scott.

@swegner
swegner merged commit bc859cc into apache:master Dec 7, 2018
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.

3 participants