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

Log Correlation from App Engine Standard PHP 7.2 #1277

Open
iamacarpet opened this Issue Sep 6, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@iamacarpet

iamacarpet commented Sep 6, 2018

Hello,

I'm trying to write logs from App Engine Standard on the new PHP 7.2 runtime, but the log correlation back to the main request isn't working out of the box.

From the documentation [1]:

Set the trace identifier in the LogEntry trace field of your app log entries. The expected format is projects/[PROJECT_ID]/traces/[TRACE_ID].

However, the logs get written with just the TRACE_ID in that field, not the full string it expects.

See here:
screenshot 1536228689
vs the entry on the main request:
screenshot 1536228721

I followed it back to the metadata provider [2] which was designed for Flex, which sets it in the old location (the appengine.googleapis.com/trace_id label in the labels array), but I don't see where this is being translated into the tracefield in the main LogEntry.

Can somebody help please?

Thanks,
iamacarpet

@dwsupplee

This comment has been minimized.

Show comment
Hide comment
@dwsupplee

dwsupplee Sep 6, 2018

Collaborator

@iamacarpet thank you for the report! I believe this is the location where the trace is being set on the entry.

It seems as though we should be able to update the linked code to the following:

$options['trace'] = sprintf(
    'projects/%s/trace/%s',
    $this->projectId, // currently this is not accessible in the `PsrLogger`, we will need to devise a way to expose it
    $labels['appengine.googleapis.com/trace_id']
);

/cc @tmatsuo to confirm if this seems like a proper way to proceed.

Collaborator

dwsupplee commented Sep 6, 2018

@iamacarpet thank you for the report! I believe this is the location where the trace is being set on the entry.

It seems as though we should be able to update the linked code to the following:

$options['trace'] = sprintf(
    'projects/%s/trace/%s',
    $this->projectId, // currently this is not accessible in the `PsrLogger`, we will need to devise a way to expose it
    $labels['appengine.googleapis.com/trace_id']
);

/cc @tmatsuo to confirm if this seems like a proper way to proceed.

@tmatsuo

This comment has been minimized.

Show comment
Hide comment
@tmatsuo

tmatsuo Sep 6, 2018

Member

It might be better to fix it in the App Engine log side. The trace id is globally unique so that the project id part is redundant.

Member

tmatsuo commented Sep 6, 2018

It might be better to fix it in the App Engine log side. The trace id is globally unique so that the project id part is redundant.

@dwsupplee

This comment has been minimized.

Show comment
Hide comment
@dwsupplee

dwsupplee Sep 6, 2018

Collaborator

That sounds good to me, I'm in favor of the shorter ID if possible.

Collaborator

dwsupplee commented Sep 6, 2018

That sounds good to me, I'm in favor of the shorter ID if possible.

@iamacarpet

This comment has been minimized.

Show comment
Hide comment
@iamacarpet

iamacarpet Sep 7, 2018

A fix App Engine side sounds good, but that implies the fix will take a lot longer.

Do you guys have it logged publicly in the issue tracker?

It'll be handy for us to keep tabs on if they plan to implement it and/or keep an eye on it completion.

iamacarpet commented Sep 7, 2018

A fix App Engine side sounds good, but that implies the fix will take a lot longer.

Do you guys have it logged publicly in the issue tracker?

It'll be handy for us to keep tabs on if they plan to implement it and/or keep an eye on it completion.

@JustinBeckwith JustinBeckwith added the 🚨 label Sep 11, 2018

@tmatsuo

This comment has been minimized.

Show comment
Hide comment
@tmatsuo

tmatsuo Sep 11, 2018

Member

@iamacarpet We haven't logged it. It's on my plate, but feel free to do so.

Member

tmatsuo commented Sep 11, 2018

@iamacarpet We haven't logged it. It's on my plate, but feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment