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 have a scenario where my logs are not being correlated to my traces. I have found that the output from tracer.get_log_correlation_context() is {'trace_id': '0', 'span_id': '0', 'service': '', 'version': '', 'env': ''}
I have a flask + gevent + gunicorn app that creates a new thread from ThreadPoolExecutor to make a network call.
I have noticed that when the network call fails from requests.exceptions.ConnectTimeout my logs within the exception handling do not have valid trace or span IDs.
I am only able to reproduce this when using ThreadPoolExecutor to create the separate thread. If I use threading.Thread the exception logging correctly gets the trace and span IDs.
Wondering why using ThreadPoolExecutor is causing this issue.
dseegerzoro
changed the title
[BUG]: get_log_correlation_context returns {'trace_id': '0', 'span_id': '0'} after an exception
[BUG]: get_log_correlation_context returns {'trace_id': '0', 'span_id': '0'} after an exception within ThreadPoolExecutor
Apr 16, 2025
Tracer Version(s)
2.16.6
Python Version(s)
Python 3.11.7
Pip Version(s)
pip 24.2
Bug Report
I have a scenario where my logs are not being correlated to my traces. I have found that the output from
tracer.get_log_correlation_context()
is{'trace_id': '0', 'span_id': '0', 'service': '', 'version': '', 'env': ''}
I have a flask + gevent + gunicorn app that creates a new thread from
ThreadPoolExecutor
to make a network call.I have noticed that when the network call fails from
requests.exceptions.ConnectTimeout
my logs within the exception handling do not have valid trace or span IDs.I am only able to reproduce this when using
ThreadPoolExecutor
to create the separate thread. If I usethreading.Thread
the exception logging correctly gets the trace and span IDs.Wondering why using
ThreadPoolExecutor
is causing this issue.Reproduction Code
Application is run with
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES DD_TRACE_DEBUG=true ddtrace-run gunicorn -k gevent 'fake_app:app'
Request to app with
curl http://127.0.0.1:5000
App Output
Error Logs
No response
Libraries in Use
My requirements.txt looks like
Pip freeze output
Operating System
Darwin Kernel Version 23.4.0
The text was updated successfully, but these errors were encountered: