Remove the DualStatsManager and the Stats interfaces#63932
Conversation
0e5c7f8 to
91f408e
Compare
dstandish
left a comment
There was a problem hiding this comment.
looks ok to me. can you summarize the potential backcompat issues?
@dstandish Any potential backcompat issues are with the providers. Because they have different versioning, the latest version could run against some version of |
0c670de to
80c947b
Compare
|
🤞🏻 |
|
Wohoo! landed! #protm |
|
Just FYI, the OL provider needed to be adjusted (#66351 ) after this change, we were using |
|
@kacpermuda Sorry for the inconvenience. I didn't put much thought into it because the back compat CI step for 3.2.1 was green. https://github.com/apache/airflow/actions/runs/25169748334/job/73789176552?pr=63932 |
|
No problem, we caught that early, we should have had tests for that and now we'll add them, sounds like a win to me. |
…g; backport fix for 3.2.x) (#68078) * Initialize Task SDK Stats in the API server so Edge Worker metrics are emitted The API server serves the Edge Worker REST API (/edge_worker/v1/...) whose heartbeat handler records edge_worker.* metrics through the Task SDK Stats singleton (resolved by the Edge provider via airflow.providers.common.compat). Unlike the scheduler, triggerer, dag-processor, executors and task runner, the API server never called Stats.initialize(...). After the auto-initializing Stats was removed in #63932, that singleton stays a NoStatsLogger in the API server process and every Edge Worker metric is silently dropped. Initialize the Task SDK Stats singleton from the FastAPI lifespan (runs once per worker, post-fork), mirroring the existing init in serde/task_runner. The call is guarded so a metrics misconfiguration can never block API server startup. Closes: #68077 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * Add newsfragment for #68078 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * fix: fix ruff errors * Remove newsfragment — bug fix does not require a user-facing changelog entry * Make API server Stats init log and docstring metric-agnostic * Update airflow-core/src/airflow/api_fastapi/app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> * Update airflow-core/tests/unit/api_fastapi/test_app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> --------- Signed-off-by: Diogo Silva <diogo.silva@five9.com> Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
…g; backport fix for 3.2.x) (apache#68078) * Initialize Task SDK Stats in the API server so Edge Worker metrics are emitted The API server serves the Edge Worker REST API (/edge_worker/v1/...) whose heartbeat handler records edge_worker.* metrics through the Task SDK Stats singleton (resolved by the Edge provider via airflow.providers.common.compat). Unlike the scheduler, triggerer, dag-processor, executors and task runner, the API server never called Stats.initialize(...). After the auto-initializing Stats was removed in apache#63932, that singleton stays a NoStatsLogger in the API server process and every Edge Worker metric is silently dropped. Initialize the Task SDK Stats singleton from the FastAPI lifespan (runs once per worker, post-fork), mirroring the existing init in serde/task_runner. The call is guarded so a metrics misconfiguration can never block API server startup. Closes: apache#68077 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * Add newsfragment for apache#68078 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * fix: fix ruff errors * Remove newsfragment — bug fix does not require a user-facing changelog entry * Make API server Stats init log and docstring metric-agnostic * Update airflow-core/src/airflow/api_fastapi/app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> * Update airflow-core/tests/unit/api_fastapi/test_app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> --------- Signed-off-by: Diogo Silva <diogo.silva@five9.com> Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
…g; backport fix for 3.2.x) (apache#68078) * Initialize Task SDK Stats in the API server so Edge Worker metrics are emitted The API server serves the Edge Worker REST API (/edge_worker/v1/...) whose heartbeat handler records edge_worker.* metrics through the Task SDK Stats singleton (resolved by the Edge provider via airflow.providers.common.compat). Unlike the scheduler, triggerer, dag-processor, executors and task runner, the API server never called Stats.initialize(...). After the auto-initializing Stats was removed in apache#63932, that singleton stays a NoStatsLogger in the API server process and every Edge Worker metric is silently dropped. Initialize the Task SDK Stats singleton from the FastAPI lifespan (runs once per worker, post-fork), mirroring the existing init in serde/task_runner. The call is guarded so a metrics misconfiguration can never block API server startup. Closes: apache#68077 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * Add newsfragment for apache#68078 Signed-off-by: Diogo Silva <diogo.silva@five9.com> * fix: fix ruff errors * Remove newsfragment — bug fix does not require a user-facing changelog entry * Make API server Stats init log and docstring metric-agnostic * Update airflow-core/src/airflow/api_fastapi/app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> * Update airflow-core/tests/unit/api_fastapi/test_app.py Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> --------- Signed-off-by: Diogo Silva <diogo.silva@five9.com> Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
This patch is removing the
DualStatsManagerand theStatsinterfaces.Action items
DualStatsManagerDualStatsManagerDualStatsManagerlogic under_shared/stats.pyextra_tagsparameters tolegacy_name_tagsDualStatsManagerStatsStatsclass by calls using thestatsmoduleincr,decr,gauge, etc. to module-level functionsStats.instanceclass attributeStats.instanceis None and then reinitializeStatsshim, to continue handling imports usingsdk.pystats.incr,stats.gauge, etc. through theStatsshimDualStatsManagerlogic exists under the newstatsfunctionsStatsnow has extra parameters for theDualStatsManagerlogicStatsinterfaceWas generative AI tooling used to co-author this PR?
Claude Sonnet 4.6 Extended
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.