apache / apache/beam

DoFn.teardown metrics are lost in Python SDK

Open
#19,394 0 comments 0 reactions 0 assignees View on GitHub
bug harness P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

If user code in DoFn.shutdown updates custom user metrics, those updates will not get registered e.g. counter increments are not registered.

Context: In [FnApiRunner.run_stages](https://github.com/apache/beam/blob/4629e82512ef1606c78cf28a2d66402c3533e23f/sdks/python/apache_beam/runners/portability/fn_api_runner.py#L342-L364), DoFn.teardown is called in worker_handler_manager.close_all, but this is called outside of the FnApiRunner.run_stage calls, so no metrics / monitoring info is retrieved there.

Imported from Jira [BEAM-7340](https://issues.apache.org/jira/browse/BEAM-7340). Original Jira may contain additional context.
Reported by: myffical@gmail.com.

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.