You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't recall whether I mentioned this, but at some point I ran into errors when I threw something into a log-field that was a list of lists. The following works around it in my particular setup:
"""Sanitize log-fields for backends"""importstructlogfromstructlog.typesimportEventDict, ProcessorclassLogFieldSanitizer:
""" Google Logging can back onto Log Sinks, which in turn are stored in BigQuery. BigQuery has at least one limitation; it cannot store lists of lists. Reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#array_type This structlog processor adjusts for that if a log-field is a list of lists. """defsetup(self) ->list[Processor]:
return [self]
def__call__(self, logger: structlog.typing.WrappedLogger, method_name: str, event_dict: EventDict) ->EventDict:
dellogger, method_name# unusedforkeyinevent_dict:
ifisinstance(event_dict[key], list):
orig=event_dict[key]
ifany(isinstance(x, list) forxinorig):
event_dict[key] = [xforxsinorigforxinxs]
returnevent_dict
The text was updated successfully, but these errors were encountered:
I can't recall whether I mentioned this, but at some point I ran into errors when I threw something into a log-field that was a list of lists. The following works around it in my particular setup:
The text was updated successfully, but these errors were encountered: