def test_sampling_rule_matches_exception(): e = Exception("an error occurred") def pattern(prop): raise e rule = SamplingRule(sample_rate=1.0, name=pattern) span = create_span(name="test.span") with mock.patch("ddtrace.sampler.log") as mock_log: assert rule.matches(span) is False mock_log.warning.assert_called_once_with( "%r pattern %r failed with %r", rule, pattern, "test.span", exc_info=True, )
def test_sampling_rule_matches_exception(): e = Exception('an error occurred') def pattern(prop): raise e rule = SamplingRule(sample_rate=1.0, name=pattern) span = create_span(name='test.span') with mock.patch('ddtrace.sampler.log') as mock_log: assert rule.matches(span) is False mock_log.warning.assert_called_once_with( '%r pattern %r failed with %r: %s', rule, pattern, 'test.span', e, )