sortega commented on code in PR #68568:
URL: https://github.com/apache/airflow/pull/68568#discussion_r3551710759
##########
shared/observability/tests/observability/metrics/test_stats.py:
##########
@@ -475,6 +496,12 @@ def
test_does_not_increment_counter_drops_invalid_tags(self):
)
self.statsd_client.incr.assert_called_once_with("test_stats_run.delay,key1=val1",
1, 1)
+ def test_standalone_tag_empty_value_emitted_as_true(self):
+ self.stats.incr("test_stats_run.delay", tags={"production": "",
"key1": "val1"})
+ self.statsd_client.incr.assert_called_once_with(
+ "test_stats_run.delay,production=true,key1=val1", 1, 1
+ )
Review Comment:
Done — folded into the InfluxDB tag-formatting parametrized test alongside
the other tag cases.
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -254,10 +255,21 @@ class RuntimeTaskInstance(TaskInstance):
@property
def stats_tags(self) -> dict[str, str]:
- """Metric tags for this task instance, including team_name when
available."""
- tags: dict[str, str] = {"dag_id": self.dag_id, "task_id": self.task_id}
- if self._ti_context_from_server and
self._ti_context_from_server.dag_run.team_name:
- tags["team_name"] = self._ti_context_from_server.dag_run.team_name
+ """Metric tags for this task instance, including dag tags and
team_name when available."""
+ tags: dict[str, str] = {}
+ if conf.getboolean("metrics", "dag_tags_in_metrics", fallback=False):
+ tags.update(build_dag_metric_tags(self.task.dag.tags))
+ # Built-in keys always win on collision.
+ tags["dag_id"] = self.dag_id
+ tags["task_id"] = self.task_id
Review Comment:
Done
--
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]