Description
The newrelic structlog hook fails to append the new relic event consumer to the structlog processors:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/app/broker/__main__.py", line 295, in <module>
logs.configure(sumologic_url=configs.secrets.SUMOLOGIC_BACKEND_URL, process_id=process_id)
File "/app/common/logs.py", line 89, in configure
logger.info("Configuring handler", handler="StreamHandler")
File "/usr/local/lib/python3.10/site-packages/structlog/_native.py", line 134, in meth
return self._proxy_to_logger(name, event, **kw)
File "/usr/local/lib/python3.10/site-packages/structlog/_base.py", line 216, in _proxy_to_logger
args, kw = self._process_event(method_name, event, event_kw)
File "/usr/local/lib/python3.10/site-packages/newrelic/hooks/logger_structlog.py", line 107, in wrap__process_event
processors.append(new_relic_event_consumer)
AttributeError: 'tuple' object has no attribute 'append'
Expected Behavior
I expect it to be able to append itself to the processors without failure
Steps to Reproduce
I don't have a reproducible example, but I'm almost 100% sure it is because newrelic assumes that the processor set passed through when configuring structlog is a list. However the function signature in configure_once is Iterable[Processor]. Because I've initialized logging with a tuple newrelic attempts to append to it and fails.
Newrelic sdk should not be making this assumption given the function signature of the structlog configuration.
Description The newrelic structlog hook fails to append the new relic event consumer to the structlog processors:
Expected Behavior I expect it to be able to append itself to the processors without failure
Troubleshooting or NR Diag results
Steps to Reproduce I don't have a reproducible example, but I'm almost 100% sure it is because newrelic assumes that the processor set passed through when configuring structlog is a list. However the function signature in
configure_once
isIterable[Processor]
. Because I've initialized logging with atuple
newrelic attempts to append to it and fails.Newrelic sdk should not be making this assumption given the function signature of the structlog configuration.