Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trace_id to log payload to enable log aggregation in GAE Flex #3355

Closed

Conversation

liyanhui1228
Copy link
Contributor

@liyanhui1228 liyanhui1228 commented May 2, 2017

Extract trace_id from HTTP request header and add it to application log. The pantheon UI will show the app logs grouped by trace_id and show them aggregated in one request.

Below is the screenshot of the aggregated log:
screenshot from 2017-05-01 17 37 44

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 2, 2017
Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liyanhui1228 Thanks for sending this patch but I'm not sure it's something we can accept / a feature we want to support.

@waprin WDYT?

PS I started a code review, but no need to address my review comments until we decide if this should exist / where this feature should live.

else:
trace_id = None

return trace_id

This comment was marked as spam.

flask = None

# Extract the trace_id
if flask:

This comment was marked as spam.

try:
import flask
except ImportError:
flask = None

This comment was marked as spam.

"""Parse flask request header to get trace_id.

:rtype: str
:return: trace_id get from flask header

This comment was marked as spam.

@@ -36,4 +38,44 @@ def format_stackdriver_json(record, message):
'severity': record.levelname,
}

# Make a best effort to add the trace id.
# First try to extract the trace_id from HTTP header, only support flask framework for now.
trace_id = parse_flask_request_header()

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@waprin
Copy link
Contributor

waprin commented May 2, 2017

This whole PR should get closed, we are just supposed to use the generic log handler according to @JustinBeckwith in #2997

@waprin
Copy link
Contributor

waprin commented May 2, 2017

Maybe we can still get the trace ID in there but it shouldn't be via the stackdriver helper that currently exists.

@theacodes
Copy link
Contributor

/cc @duggelz for context

@dhermes
Copy link
Contributor

dhermes commented May 2, 2017

@waprin Can we make a decision quickly and either move forward or close this thing? (i.e. just don't want it to come off our plates and sit open in limbo)

@waprin
Copy link
Contributor

waprin commented May 2, 2017

I think we should close and @liyanhui1228 and @duggelz should have a quick chat about best way to do this.

@dhermes
Copy link
Contributor

dhermes commented May 2, 2017

OK, closing now. We can always re-open.

@dhermes dhermes closed this May 2, 2017
@duggelz
Copy link

duggelz commented May 2, 2017

This has nothing to do with #2997

@waprin
Copy link
Contributor

waprin commented May 2, 2017

It has everything to do with it because the helper method it's modifying is used to format the messages for /var/log/appengine.

@theacodes
Copy link
Contributor

Okay - deep breath - we failed to properly support a new contributor here. We need to do better.

It's clear that while we want this feature, we're not ready to implement it. So, let's create a bug/feature request for this feature and mark all blocking bugs. If the owners of those bugs can't resolve them in a timely manner, let's see what we can do to enable @liyanhui1228 or @duggelz to address them so that this feature can be implemented.

@dhermes or @lukesneeringer, can you own this? If not, please let me know and I will do this personally.

@lukesneeringer
Copy link
Contributor

I am happy to own it if needed ("buck stops here" kind of thing), but I am not sure I am the right person. I have read over this ticket and I do not intuitively grok the issue in question.

I think the issue is that if there is an HTTP header that we can easily get at, we want to send it to Stackdriver in some way?

Best case for me is if @jonparrott owns this, but I am willing to if needed. :-)

@theacodes
Copy link
Contributor

@lukesneeringer I'm on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants