diff --git a/datadog_checks_base/datadog_checks/checks/base.py b/datadog_checks_base/datadog_checks/checks/base.py index 5915986b8b841f..cfd36fcfd05ab0 100644 --- a/datadog_checks_base/datadog_checks/checks/base.py +++ b/datadog_checks_base/datadog_checks/checks/base.py @@ -29,14 +29,6 @@ from ..utils.limiter import Limiter -# Metric types for which it's only useful to submit once per context -ONE_PER_CONTEXT_METRIC_TYPES = [ - aggregator.GAUGE, - aggregator.RATE, - aggregator.MONOTONIC_COUNT, -] - - class AgentCheck(object): """ The base class for any Agent based integrations @@ -55,6 +47,13 @@ class AgentCheck(object): """ DEFAULT_METRIC_LIMIT = 0 + # Metric types for which it's only useful to submit once per context + ONE_PER_CONTEXT_METRIC_TYPES = [ + aggregator.GAUGE, + aggregator.RATE, + aggregator.MONOTONIC_COUNT, + ] + def __init__(self, *args, **kwargs): """ args: `name`, `init_config`, `agentConfig` (deprecated), `instances` @@ -165,7 +164,7 @@ def _submit_metric(self, mtype, name, value, tags=None, hostname=None, device_na hostname = b'' if self.metric_limiter: - if mtype in ONE_PER_CONTEXT_METRIC_TYPES: + if mtype in self.ONE_PER_CONTEXT_METRIC_TYPES: # Fast path for gauges, rates, monotonic counters, assume one context per call if self.metric_limiter.is_reached(): return diff --git a/wmi_check/test/test_wmi_check.py b/wmi_check/test/test_wmi_check.py index 24cc0e6cc0534f..3dc79c6424afff 100644 --- a/wmi_check/test/test_wmi_check.py +++ b/wmi_check/test/test_wmi_check.py @@ -10,6 +10,7 @@ from nose.plugins.attrib import attr # project +from datadog_checks.stubs import aggregator from tests.checks.common import AgentCheckTest from tests.core.test_wmi import SWbemServices, TestCommonWMI