Flush in-memory OTel metrics at process shutdown#61808
Merged
potiuk merged 2 commits intoapache:mainfrom Feb 13, 2026
Merged
Conversation
2 tasks
Contributor
Author
|
@Nataneljpwd Thanks for the review! |
potiuk
approved these changes
Feb 13, 2026
Contributor
Backport failed to create: v3-1-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker a9df122 v3-1-testThis should apply the commit to the v3-1-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
Contributor
Author
|
@potiuk Thank you for the review and the merge! |
Member
Contributor
Author
|
@potiuk I resolved the conflicts. Now, if I understand correctly, I have to create a PR against the https://github.com/xBis7/airflow/tree/backport-a9df122-v3-1-test |
1 task
Ratasa143
pushed a commit
to Ratasa143/airflow
that referenced
this pull request
Feb 15, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
potiuk
pushed a commit
that referenced
this pull request
Feb 17, 2026
choo121600
pushed a commit
to choo121600/airflow
that referenced
this pull request
Feb 22, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
Subham-KRLX
pushed a commit
to Subham-KRLX/airflow
that referenced
this pull request
Mar 4, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
vatsrahul1001
pushed a commit
that referenced
this pull request
Mar 4, 2026
dominikhei
pushed a commit
to dominikhei/airflow
that referenced
this pull request
Mar 11, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
Ankurdeewan
pushed a commit
to Ankurdeewan/airflow
that referenced
this pull request
Mar 15, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
radhwene
pushed a commit
to radhwene/airflow
that referenced
this pull request
Mar 21, 2026
* flush in-memory otel metrics at process shutdown * fix module for test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
When using OpenTelemetry as the stat logger, all metrics are stored in-memory and exported to the collector in batches at fixed intervals.
Subprocesses like the
task_runner, can be very short-lived and the result is that the process exits before it exports any metrics.Solution
The solution is to register a hook that performs a
force_flush()at shutdown.All process forks so far are resetting their state just like here
https://github.com/apache/airflow/blob/main/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L355
I tested it and the changes in the
stats.pyaren't used but any future forks that don't reset their parent's state, are going to result in missing metrics and it's going to be hard figuring out why. I think it's a good safe-guard to keep.Tests
I tested the changes manually, added an integration test and a unit test.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.