Skip to content

Commit

Permalink
exclude invalid attributes, which might also trigger endless logging …
Browse files Browse the repository at this point in the history
…loops
  • Loading branch information
a-recknagel authored and Arne Caratti committed Feb 16, 2024
1 parent b0a5a8d commit c9b48cf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _get_attributes(self, record: logging.LogRecord) -> Attributes:
attributes = {
k: v
for k, v in vars(record).items()
if k not in _EXCLUDED_ATTRIBUTES
if k not in _EXCLUDED_ATTRIBUTES and v is not None
}

# Add standard code attributes for logs.
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/tests/logs/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def test_log_record_user_attributes(self):
log_record = args[0]

self.assertIsNotNone(log_record)
self.assertEqual(len(log_record.attributes), 4)
self.assertEqual(
log_record.attributes,
{**log_record.attributes, **{"http.status_code": 200}},
Expand Down

0 comments on commit c9b48cf

Please sign in to comment.