Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/metrics/statsd_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def wrapper(
if stat is not None and tags is not None:
for k, v in tags.items():
if self.metric_tags_validator.test(k):
if all(c not in [",", "="] for c in v + k):
if all(c not in [",", "="] for c in f"{v}{k}"):
stat += f",{k}={v}"
else:
log.error("Dropping invalid tag: %s=%s.", k, v)
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ def test_increment_counter(self):
def test_increment_counter_with_tags(self):
self.stats.incr(
"test_stats_run.delay",
tags={"key0": "val0", "key1": "val1", "key2": "val2"},
tags={"key0": 0, "key1": "val1", "key2": "val2"},
)
self.statsd_client.incr.assert_called_once_with("test_stats_run.delay,key0=val0,key1=val1", 1, 1)
self.statsd_client.incr.assert_called_once_with("test_stats_run.delay,key0=0,key1=val1", 1, 1)

def test_does_not_increment_counter_drops_invalid_tags(self):
self.stats.incr(
Expand Down