Skip to content

Commit 5cb7264

Browse files
committed
.
1 parent c9f6f3d commit 5cb7264

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

tests/test_logs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,16 @@ def test_log_attributes_override_scope_attributes(sentry_init, capture_envelopes
600600

601601

602602
@minimum_python_37
603-
def test_preserialization(sentry_init, capture_envelopes):
604-
"""We don't store references to objects in attributes."""
605-
sentry_init(enable_logs=True)
603+
def test_attributes_preserialized_in_before_send(sentry_init, capture_envelopes):
604+
"""We don't surface references to objects in attributes."""
605+
606+
def before_send_log(log, _):
607+
assert isinstance(log["attributes"]["instance"], str)
608+
assert isinstance(log["attributes"]["dictionary"], str)
609+
610+
return log
611+
612+
sentry_init(enable_logs=True, before_send_log=before_send_log)
606613

607614
envelopes = capture_envelopes()
608615

tests/test_metrics.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,16 @@ def test_metric_attributes_override_scope_attributes(sentry_init, capture_envelo
337337
assert metric["attributes"]["temp.attribute"] == "value2"
338338

339339

340-
def test_preserialization(sentry_init, capture_envelopes):
341-
"""We don't store references to objects in attributes."""
342-
sentry_init()
340+
def test_attributes_preserialized_in_before_send(sentry_init, capture_envelopes):
341+
"""We don't surface references to objects in attributes."""
342+
343+
def before_send_metric(metric, _):
344+
assert isinstance(metric["attributes"]["instance"], str)
345+
assert isinstance(metric["attributes"]["dictionary"], str)
346+
347+
return metric
348+
349+
sentry_init(before_send_metric=before_send_metric)
343350

344351
envelopes = capture_envelopes()
345352

0 commit comments

Comments
 (0)