Skip to content

Commit

Permalink
tentatively fix wmi_check test
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello committed Aug 30, 2018
1 parent 82ccdd2 commit cb07060
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 8 additions & 9 deletions datadog_checks_base/datadog_checks/checks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions wmi_check/test/test_wmi_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cb07060

Please sign in to comment.