Skip to content
Merged
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
9 changes: 3 additions & 6 deletions airflow/metrics/otel_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,9 @@ def get_counter(self, name: str, attributes: Attributes = None):
:param attributes: Counter attributes, used to generate a unique key to store the counter.
"""
key = _generate_key_name(name, attributes)
if key in self.map.keys():
return self.map[key]
else:
new_counter = self._create_counter(name)
self.map[key] = new_counter
return new_counter
if key not in self.map:
self.map[key] = self._create_counter(name)
return self.map[key]

def del_counter(self, name: str, attributes: Attributes = None) -> None:
"""
Expand Down