From 21e65934c8e0db07b7c66eab46e3c200231affbe Mon Sep 17 00:00:00 2001 From: Andrew Zhang Date: Fri, 13 Aug 2021 14:17:00 -0400 Subject: [PATCH 1/2] Add exception for good service check messages --- datadog_checks_base/datadog_checks/base/stubs/aggregator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datadog_checks_base/datadog_checks/base/stubs/aggregator.py b/datadog_checks_base/datadog_checks/base/stubs/aggregator.py index b7cdeab3df127..47b11fe8af19b 100644 --- a/datadog_checks_base/datadog_checks/base/stubs/aggregator.py +++ b/datadog_checks_base/datadog_checks/base/stubs/aggregator.py @@ -10,6 +10,7 @@ from six import iteritems +from datadog_checks.base.constants import ServiceCheck from ..utils.common import ensure_unicode, to_native_string from .common import HistogramBucketStub, MetricStub, ServiceCheckStub from .similar import build_similar_elements_msg @@ -123,6 +124,9 @@ def submit_metric_e2e( self._metrics[name].append(MetricStub(name, mtype, value, tags, hostname, device)) def submit_service_check(self, check, check_id, name, status, tags, hostname, message): + if status == ServiceCheck.OK and message: + raise Exception("Expected empty message on OK service check") + check_tag_names(name, tags) self._service_checks[name].append(ServiceCheckStub(check_id, name, status, tags, hostname, message)) From b13629370ad845f398e9b19187d23c17a18175c1 Mon Sep 17 00:00:00 2001 From: Andrew Zhang Date: Fri, 13 Aug 2021 14:22:37 -0400 Subject: [PATCH 2/2] Fix import --- datadog_checks_base/datadog_checks/base/stubs/aggregator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datadog_checks_base/datadog_checks/base/stubs/aggregator.py b/datadog_checks_base/datadog_checks/base/stubs/aggregator.py index 47b11fe8af19b..dfc5cf303a269 100644 --- a/datadog_checks_base/datadog_checks/base/stubs/aggregator.py +++ b/datadog_checks_base/datadog_checks/base/stubs/aggregator.py @@ -10,7 +10,7 @@ from six import iteritems -from datadog_checks.base.constants import ServiceCheck +from ..constants import ServiceCheck from ..utils.common import ensure_unicode, to_native_string from .common import HistogramBucketStub, MetricStub, ServiceCheckStub from .similar import build_similar_elements_msg