Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewqian2001datadog committed Sep 9, 2024
1 parent 1424766 commit e6a5adc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions datadog/dogstatsd/buffered_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def __init__(self, name, tags, metric_type, max_metrics=0, specified_rate=1.0):
self.max_metrics = max_metrics
self.specified_rate = specified_rate
self.data = []
self.stored_metrics = 0
self.total_metrics = 0
self.stored_metrics = 1
self.total_metrics = 1

def aggregate(self, value):
self.data.append(value)
Expand Down Expand Up @@ -39,10 +39,8 @@ def flush(self):
if self.specified_rate != 1.0:
rate = self.specified_rate
else:
if total_metrics != 0:
rate = self.stored_metrics / total_metrics
else:
rate = 1.0
rate = self.stored_metrics / total_metrics

return {
'name': self.name,
'tags': self.tags,
Expand Down

0 comments on commit e6a5adc

Please sign in to comment.