kaxil commented on code in PR #76737:
URL: https://github.com/apache/airflow/pull/76737#discussion_r4697254604
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -4130,6 +4132,13 @@ def test_emit_pool_metrics_team_name(self,
mock_get_backend, multi_team, expecte
mock_stats.gauge.assert_any_call("pool.queued_slots", mock.ANY,
tags=expected_tags)
mock_stats.gauge.assert_any_call("pool.running_slots", mock.ANY,
tags=expected_tags)
+ @pytest.mark.parametrize("state", sorted(TI_METRIC_STATES))
+ def test_ti_metric_state_has_legacy_name(self, state):
Review Comment:
This never touches the DB, but inside `TestSchedulerJob` each of the 5 cases
runs the autouse `_clean_db()` before and after, and it inherits the module's
`db_test` mark. Could it be a module-level function with
`@pytest.mark.non_db_test_override` instead?
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -4130,6 +4132,13 @@ def test_emit_pool_metrics_team_name(self,
mock_get_backend, multi_team, expecte
mock_stats.gauge.assert_any_call("pool.queued_slots", mock.ANY,
tags=expected_tags)
mock_stats.gauge.assert_any_call("pool.running_slots", mock.ANY,
tags=expected_tags)
+ @pytest.mark.parametrize("state", sorted(TI_METRIC_STATES))
+ def test_ti_metric_state_has_legacy_name(self, state):
+ """Plain StatsD drops tags, so a gauge without a legacy name merges
every task into one series."""
+ metric = MetricsRegistry().get(f"ti.{state}")
+ assert metric is not None
+ assert metric.get("legacy_name", "-") != "-"
Review Comment:
A `legacy_name` without `{dag_id}` and `{task_id}` in it would still pass
here and merge every task into one series, which is the case the docstring
describes. Worth also asserting `{"dag_id", "task_id"} <=
set(metric.get("name_variables", []))`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]