Skip to content

[BEAM-2057] Add a test for metrics reporting in Spark#2730

Closed
holdenk wants to merge 2 commits intoapache:masterfrom
holdenk:BEAM-2057-test-metrics-spark-metrics-sink
Closed

[BEAM-2057] Add a test for metrics reporting in Spark#2730
holdenk wants to merge 2 commits intoapache:masterfrom
holdenk:BEAM-2057-test-metrics-spark-metrics-sink

Conversation

@holdenk
Copy link
Contributor

@holdenk holdenk commented Apr 27, 2017

Add a test for metrics reporting in Spark

@dhalperi
Copy link
Contributor

Stupid Travis still being broken. (That's a bug for a larger hackathon :p)

Overview: This looks pretty much perfect as-is -- great, though I'd probably defer review to @aviemzur who implemented the Spark metrics connector.

However, I wonder is this test needed given that the MetricsTest runs in the Spark @ValidatesRunner suite? I can see it either way -- the MetricsTest is more of an integration test.

@dhalperi
Copy link
Contributor

public ExternalResource inMemoryMetricsSink = new InMemoryMetricsSinkRule();

@Rule
public InMemoryMetricsSinkRule clearInMemoryMetricsSink = new InMemoryMetricsSinkRule();
Copy link
Contributor

@staslev staslev Apr 27, 2017

Choose a reason for hiding this comment

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

I believe either of the two will suffice, and the other one can be safely removed.

In NamedAggregatorsTest.java we had two rules like so:

@Rule
public ExternalResource inMemoryMetricsSink = new InMemoryMetricsSinkRule();

@Rule
public ClearAggregatorsRule clearAggregators = new ClearAggregatorsRule();

due to the aggregators that needed to be cleared in addition to the metrics themselves.
The new Metrics API removes the use of aggregators, so this should not be an issue.

@aviemzur
Copy link
Member

@dhalperi this is needed to test that Beam metrics are reported via Spark's metrics sink, this isn't tested by MetricsTest as this is specific to Spark runner.

/**
* A test for the metrics reporting in Spark.
*/
public class SparkMetricsTest {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe SparkMetricsSinkTest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good

public void testNonExistingMetricName() throws Exception {
runPipeline();

final Long valueOf = InMemoryMetrics.<Long>valueOf("myMissingAggregator");
Copy link
Member

@aviemzur aviemzur Apr 27, 2017

Choose a reason for hiding this comment

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

Why is this test needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, I'll remove this.

Copy link
Member

@aviemzur aviemzur left a comment

Choose a reason for hiding this comment

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

Looks good! a few comments on top of what was already commented by others.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 69.83% when pulling b6d3f03 on holdenk:BEAM-2057-test-metrics-spark-metrics-sink into b82cd24 on apache:master.

@dhalperi
Copy link
Contributor

R: @aviemzur will handle pushing across the finish line, I shouldn't have interjected. Sorry :)

@holdenk holdenk force-pushed the BEAM-2057-test-metrics-spark-metrics-sink branch from b6d3f03 to d498d84 Compare April 28, 2017 19:53
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d498d84 on holdenk:BEAM-2057-test-metrics-spark-metrics-sink into ** on apache:master**.

Copy link
Member

@aviemzur aviemzur left a comment

Choose a reason for hiding this comment

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

LGTM, merging.

@asfgit asfgit closed this in 81474ae Apr 29, 2017
@holdenk
Copy link
Contributor Author

holdenk commented Apr 29, 2017

Thanks y'all - great experience for my first Beam PR :) <3

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.

5 participants