Send trace context with logs from web applications
See original GitHub issueWhen running on App Engine (and potentially other platforms in the future), we should send along the trace context when writing logs. This context is available in the HTTP request headers as X-Cloud-Trace-Context
and should be passed in the structured log as the traceId
. For more details, read here.
Since this is a web request header, we will need to make the core of this web application-framework agnostic. We’ll then need to write helpers/adaptors for Flask and Django.
To my knowledge, we have one blocking bug (#2997) that needs to be resolved before this can happen. Secondly, we need to agree on where the framework helpers should live. (@dhermes). I’m not aware of any other blockers.
Assigned to initially @waprin, as he currently has the most context and can hopefully address open questions and point out any additional pre-work that needs to be done. @liyanhui1228 and @duggelz are the product owners for this, and have offered to provide the implementation.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (11 by maintainers)
Your PR fixed the issue for us. Thanks!
@aatreya Instead of using
client.setup_logging()
, you can also add handler to a logger like below as described in the document:Moving the
get_gae_labels
toemit()
function can simplify the code, I have prepared a PR for changing that code path. But you can use the above code as the work around for now.