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
When using nameko_tracer.formatters.JSONFormatter, logging fails with the following trace:
--- Logging error ---
Traceback (most recent call last):
File "c:\Users\chris.platts\AppData\Local\Programs\Python\Python36-32\lib\logging\handlers.py", line 633, in emit
s = self.makePickle(record)
File "c:\Users\chris.platts\Dropbox\platform-tool-svc\process-service\env\lib\site-packages\graypy\rabbitmq.py", line 74, in makePickle
return json.dumps(message_dict)
File "c:\Users\chris.platts\AppData\Local\Programs\Python\Python36-32\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "c:\Users\chris.platts\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "c:\Users\chris.platts\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "c:\Users\chris.platts\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'Stage' is not JSON serializable
Call stack:
File "c:\Users\chris.platts\Dropbox\platform-tool-svc\process-service\env\lib\site-packages\eventlet\greenthread.py", line 219, in main
result = function(*args, **kwargs)
File "c:\Users\chris.platts\Dropbox\platform-tool-svc\process-service\env\lib\site-packages\nameko\containers.py", line 411, in _run_worker
self._worker_result(worker_ctx, result, exc_info)
File "c:\Users\chris.platts\Dropbox\platform-tool-svc\process-service\env\lib\site-packages\nameko\containers.py", line 432, in _worker_result
provider.worker_result(worker_ctx, result, exc_info)
File "c:\Users\chris.platts\Dropbox\platform-tool-svc\process-service\env\lib\site-packages\nameko_tracer\dependency.py", line 95, in worker_result
extra=extra)
Message: '[%s] entrypoint result trace'
Arguments: ('process_service.start_job.97879a32-41db-4bed-a6c8-9db1cdf82242',)
Environment is:
Windows 10
Python v3.6.3
nameko_tracer v 1.2.0
A quick fix appears to be to use 'stage': constants.Stage.request.value rather than 'stage': constants.Stage.request
The text was updated successfully, but these errors were encountered:
Interesting part of your stack-trace is that the python built-in StreamHandler ends up calling makePickle of graypy\rabbitmq.py. Looks like this is the culprit - the unformatted extra is included by the Graypy handler causing the JSON serialisation to fail. GELFRabbitHandler extends SocketHandler which for some reason bypasses any formatter set and tries to pickle the log record instead (probably because the intended use is to unwrap the pickled log record on the other side to be formatted there). Unfortunately GELFRabbitHandler overrides makePickle method replacing the pickle serialisation with JSON one and with hardcoded formatting which than includes extra to the serialised dictionary.
I quick fix may be passing False to extra_fields of your GELFRabbitHandler handler:
Hi,
When using
nameko_tracer.formatters.JSONFormatter
, logging fails with the following trace:Environment is:
A quick fix appears to be to use
'stage': constants.Stage.request.value
rather than'stage': constants.Stage.request
The text was updated successfully, but these errors were encountered: