This is an automated email from the ASF dual-hosted git repository.
uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new c92c9611ed Avoid creating unnecessary list when parsing stats datadog
tags (#33943)
c92c9611ed is described below
commit c92c9611ede6b9156ebb2eaca2443340270435f8
Author: Hussein Awala <[email protected]>
AuthorDate: Thu Aug 31 05:40:35 2023 +0200
Avoid creating unnecessary list when parsing stats datadog tags (#33943)
---
airflow/stats.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/airflow/stats.py b/airflow/stats.py
index f6a6e97c54..569bce4806 100644
--- a/airflow/stats.py
+++ b/airflow/stats.py
@@ -65,14 +65,10 @@ class _Stats(type):
@classmethod
def get_constant_tags(cls) -> list[str]:
"""Get constant DataDog tags to add to all stats."""
- tags: list[str] = []
tags_in_string = conf.get("metrics", "statsd_datadog_tags",
fallback=None)
- if tags_in_string is None or tags_in_string == "":
- return tags
- else:
- for key_value in tags_in_string.split(","):
- tags.append(key_value)
- return tags
+ if not tags_in_string:
+ return []
+ return tags_in_string.split(",")
if TYPE_CHECKING: