1 parent 95322eb commit 880b860Copy full SHA for 880b860
2 files changed
sentry_sdk/integrations/logging.py
@@ -139,7 +139,8 @@ def _extra_from_record(record):
139
return {
140
k: v
141
for k, v in iteritems(vars(record))
142
- if k not in COMMON_RECORD_ATTRS and not k.startswith("_")
+ if k not in COMMON_RECORD_ATTRS
143
+ and (not isinstance(k, str) or not k.startswith("_"))
144
}
145
146
tests/integrations/logging/test_logging.py
@@ -61,6 +61,17 @@ def test_logging_extra_data(sentry_init, capture_events):
61
)
62
63
64
+def test_logging_extra_data_integer_keys(sentry_init, capture_events):
65
+ sentry_init(integrations=[LoggingIntegration()], default_integrations=False)
66
+ events = capture_events()
67
+
68
+ logger.critical("integer in extra keys", extra={1: 1})
69
70
+ event, = events
71
72
+ assert event["extra"] == {"1": 1}
73
74
75
@pytest.mark.xfail(sys.version_info[:2] == (3, 4), reason="buggy logging module")
76
def test_logging_stack(sentry_init, capture_events):
77
sentry_init(integrations=[LoggingIntegration()], default_integrations=False)
0 commit comments