apache / apache/beam

Unskip test_metrics (py) in Spark runner

Open
#20,380 0 comments 0 reactions 0 assignees View on GitHub
improvement P3 portability runners spark tests
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

For the test_metrics failure, I found that metrics are being passed to Python. The test breaks because no metrics match the filter [1], because the step names are transformed somehow such that the filter logic is too strict to recognize [2]:

Spark Runner:
MetricKey(step=ref_AppliedPTransform_count1_17, metric=MetricName(namespace=ns, name=counter), labels={}): 2
MetricKey(step=ref_AppliedPTransform_count2_18, metric=MetricName(namespace=ns, name=counter), labels={}): 4
...

Fn API Runner:
MetricKey(step=count1, metric=MetricName(namespace=ns, name=counter), labels={}): 2,
MetricKey(step=count2, metric=MetricName(namespace=ns, name=counter), labels={}): 4

Also, note that Flink has its own, completely different implementation of test_metrics [3].

[1] https://github.com/apache/beam/blob/2ef7b9db8af015dcba544b93df00a4e54cd8caf2/sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py#L744
[2] https://github.com/apache/beam/blob/2ef7b9db8af015dcba544b93df00a4e54cd8caf2/sdks/python/apache_beam/metrics/metric.py#L151-L155
[3] https://github.com/apache/beam/blob/2ef7b9db8af015dcba544b93df00a4e54cd8caf2/sdks/python/apache_beam/runners/portability/flink_runner_test.py#L251

Imported from Jira [BEAM-10689](https://issues.apache.org/jira/browse/BEAM-10689). Original Jira may contain additional context.
Reported by: ibzib.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.