Skip to content

Commit 10c7abe

Browse files
committed
chore(integrations): Halting events to be logged as warning
1 parent d6bd530 commit 10c7abe

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/sentry/integrations/utils/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def record_event(
210210
if outcome == EventLifecycleOutcome.FAILURE:
211211
logger.warning(key, **log_params)
212212
elif outcome == EventLifecycleOutcome.HALTED:
213-
logger.info(key, **log_params)
213+
logger.warning(key, **log_params)
214214

215215
@staticmethod
216216
def _report_flow_error(message) -> None:

tests/sentry/integrations/utils/test_lifecycle_metrics.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_recording_halt(
9090
with metric_obj.capture(assume_success=False):
9191
pass
9292
self._check_metrics_call_args(mock_metrics, "halted")
93-
mock_logger.info.assert_called_once_with(
93+
mock_logger.warning.assert_called_once_with(
9494
"integrations.slo.halted",
9595
extra={
9696
"integration_domain": "messaging",
@@ -111,7 +111,7 @@ def test_recording_explicit_halt_with_exception(
111111
lifecycle.record_halt(ExampleException(""), extra={"even": "more"})
112112

113113
self._check_metrics_call_args(mock_metrics, "halted")
114-
mock_logger.info.assert_called_once_with(
114+
mock_logger.warning.assert_called_once_with(
115115
"integrations.slo.halted",
116116
extra={
117117
"extra": "value",
@@ -135,7 +135,7 @@ def test_recording_explicit_halt_with_str(
135135
lifecycle.record_halt("Integration went boom", extra={"even": "more"})
136136

137137
self._check_metrics_call_args(mock_metrics, "halted")
138-
mock_logger.info.assert_called_once_with(
138+
mock_logger.warning.assert_called_once_with(
139139
"integrations.slo.halted",
140140
extra={
141141
"outcome_reason": "Integration went boom",
@@ -254,7 +254,7 @@ def test_recording_halt_with_create_issue_true(
254254

255255
self._check_metrics_call_args(mock_metrics, "halted")
256256
mock_sentry_sdk.capture_exception.assert_called_once()
257-
mock_logger.info.assert_called_once_with(
257+
mock_logger.warning.assert_called_once_with(
258258
"integrations.slo.halted",
259259
extra={
260260
"extra": "value",
@@ -366,7 +366,7 @@ def test_sample_log_rate_halt_with_sampling(
366366
# Metrics should always be called
367367
self._check_metrics_call_args(mock_metrics, "halted")
368368
# Logger should be called since 0.05 < 0.2
369-
mock_logger.info.assert_called_once()
369+
mock_logger.warning.assert_called_once()
370370
mock_random.random.assert_called_once()
371371

372372
@mock.patch("sentry.integrations.utils.metrics.random")
@@ -406,7 +406,7 @@ def test_per_call_sample_log_rate_skips_when_below_threshold(
406406
# Metrics should always be called
407407
self._check_metrics_call_args(mock_metrics, "halted")
408408
# Logger should NOT be called since 0.15 > 0.05 (per-call rate)
409-
mock_logger.info.assert_not_called()
409+
mock_logger.warning.assert_not_called()
410410
mock_random.random.assert_called_once()
411411

412412
@mock.patch("sentry.integrations.utils.metrics.random")
@@ -466,7 +466,7 @@ def test_sample_log_rate_on_assume_success_false_exit(
466466
# Metrics should always be called
467467
self._check_metrics_call_args(mock_metrics, "halted")
468468
# Logger should NOT be called since 0.25 > 0.2
469-
mock_logger.info.assert_not_called()
469+
mock_logger.warning.assert_not_called()
470470
mock_random.random.assert_called_once()
471471

472472
@mock.patch("sentry.integrations.utils.metrics.logger")
@@ -492,4 +492,4 @@ def test_default_sample_log_rate_is_one(
492492
pass # Will record halt
493493

494494
# Should log since default is 1.0
495-
mock_logger.info.assert_called_once()
495+
mock_logger.warning.assert_called_once()

0 commit comments

Comments
 (0)