Skip to content

Commit e035a18

Browse files
committed
Fix LogFlusher unreachable 'no metrics' branch
Change condition from 'if parts:' to 'if len(parts) > 1:' to correctly detect when no metrics are present beyond the prefix. Previously, parts was always truthy since it was initialized with [self.__prefix], making the 'No metrics to flush' message unreachable.
1 parent b706688 commit e035a18

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sentry_streams/sentry_streams/metrics/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def flush(
189189
for name, value, tags in gauges:
190190
tags_str = " ".join(tags) if tags else ""
191191
parts.append(f"gauge {name.value}={value} {tags_str}".strip())
192-
if parts:
192+
if len(parts) > 1:
193193
logger.info(" | ".join(parts))
194194
else:
195195
logger.info("No metrics to flush")

0 commit comments

Comments
 (0)