Skip to content

Commit

Permalink
Raise exception for OK service checks with messages (#9958)
Browse files Browse the repository at this point in the history
* Add exception for good service check messages

* Fix import
  • Loading branch information
yzhan289 authored Sep 9, 2021
1 parent 7e18459 commit e35c237
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datadog_checks_base/datadog_checks/base/stubs/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from six import iteritems

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
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit e35c237

Please sign in to comment.