Skip to content

Commit

Permalink
remove client from aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewqian2001datadog committed Jul 16, 2024
1 parent 1b0bda3 commit 2ce4ebf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
16 changes: 1 addition & 15 deletions datadog/dogstatsd/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@


class Aggregator(object):
def __init__(self, client):
self.client = client
def __init__(self):
self.metrics_map = {
MetricType.COUNT: {},
MetricType.GAUGE: {},
Expand All @@ -21,19 +20,6 @@ def __init__(self, client):
MetricType.SET: threading.RLock(),
}

def start(self, flush_interval):
self.flush_interval = flush_interval
self.client._start_flush_thread(flush_interval, self.send_metrics)

def stop(self):
self.client._stop_flush_thread(self.send_metrics)

def send_metrics(self):
for metric in self.flush_metrics():
self.client._report(
metric.name, metric.type, metric.value, metric.tags, metric.timestamp
)

def flush_metrics(self):
metrics = []
for metric_type in self.metrics_map.keys():
Expand Down
5 changes: 1 addition & 4 deletions tests/unit/dogstatsd/test_aggregator.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import unittest
from mock import Mock
from datadog.dogstatsd import DogStatsd
from datadog.dogstatsd.metric_types import MetricType
from datadog.dogstatsd.aggregator import Aggregator


class TestAggregator(unittest.TestCase):
def setUp(self):
self.client = Mock(spec=DogStatsd)
self.aggregator = Aggregator(self.client)
self.aggregator = Aggregator()

def test_aggregator_sample(self):
tags = ["tag1", "tag2"]
Expand Down

0 comments on commit 2ce4ebf

Please sign in to comment.