Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed insert id from extractable fields
  • Loading branch information
daniel-sanche committed Oct 15, 2021
commit dbdc85d2c2b174ca127d731d4aa3350263844bf4
4 changes: 2 additions & 2 deletions google/cloud/logging_v2/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
("source_location", None),
)

_STRUCT_EXTRACTABLE_FIELDS = ['severity', 'trace', 'span_id', "insert_id"]
_STRUCT_EXTRACTABLE_FIELDS = ['severity', 'trace', 'span_id']

class Logger(object):
"""Loggers represent named targets for log entries.
Expand Down Expand Up @@ -202,7 +202,7 @@ def log_struct(self, info, *, client=None, **kw):
See :class:`~logging_v2.entries.LogEntry`.
"""
for field in _STRUCT_EXTRACTABLE_FIELDS:
# see if LogEntry data was left in the struct dict
# attempt to copy relevant fields from the payload into the LogEntry body
if field in info and field not in kw:
kw[field] = info[field]
self._do_log(client, StructEntry, info, **kw)
Expand Down
2 changes: 0 additions & 2 deletions tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ def test_log_struct_logentry_data(self):
"severity": "warning",
"trace": "123",
"span_id": "456",
"insert_id": "0",
}
logger.log(JSON_PAYLOAD)
entries = _list_entries(logger)
Expand All @@ -415,7 +414,6 @@ def test_log_struct_logentry_data(self):
self.assertEqual(entries[0].severity, "WARNING")
self.assertEqual(entries[0].trace, JSON_PAYLOAD['trace'])
self.assertEqual(entries[0].span_id, JSON_PAYLOAD['span_id'])
self.assertEqual(entries[0].insert_id, JSON_PAYLOAD['insert_id'])

def test_log_handler_async(self):
LOG_MESSAGE = "It was the worst of times"
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ def test_log_struct_inference(self):
"severity": "warning",
"trace": "123",
"span_id": "456",
"insert_id": "0",
}
RESOURCE = detect_resource(self.PROJECT)._to_dict()
ENTRIES = [
Expand All @@ -402,7 +401,6 @@ def test_log_struct_inference(self):
"severity": "WARNING",
"trace": "123",
"spanId": "456",
"insertId": "0",
"resource": RESOURCE,
}
]
Expand Down