Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scheduler and triggerer crashes in daemon mode when statsd metrics are enabled #35181

Merged
merged 4 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions airflow/cli/commands/daemon_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def run_command_with_daemon_option(
)

with ctx:
# in daemon context stats client needs to be reinitialized.
from airflow.stats import Stats

Stats.instance = None
callback()
else:
signal.signal(signal.SIGINT, sigint_handler)
Expand Down
2 changes: 2 additions & 0 deletions airflow/metrics/base_stats_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
class StatsLogger(Protocol):
"""This class is only used for TypeChecking (for IDEs, mypy, etc)."""

instance: StatsLogger | NoStatsLogger | None = None

@classmethod
def incr(
cls,
Expand Down