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

Automatically add trace property to v2 function logs #1192

Merged
merged 16 commits into from
Sep 1, 2022
Merged

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Aug 19, 2022

All traffic to Cloud Run revisions are populated with traceparent and X-Cloud-Trace-Context header doc and Functions Framework helpfully processes and injects the traceparent on cloudevent payload (See GoogleCloudPlatform/functions-framework#47).

We take advantage of this and automatically inject trace property to all logs generated from functions.logger. All logs emitted from functions logger then are correlated with requests - and it even works when concurrency > 1.

Traced logs are awesome with Cloud Logging:

image

And looks great in Cloud Trace too!

image

@taeold taeold changed the title Automatically add traceid to for logs from v2 functions. Automatically add traceid to v2 function logs Aug 19, 2022
@taeold taeold changed the base branch from master to launch.next August 19, 2022 00:21
@taeold taeold added this to the v4 milestone Aug 22, 2022
@taeold taeold marked this pull request as ready for review August 23, 2022 23:17
@taeold taeold changed the title Automatically add traceid to v2 function logs Automatically add trace property to v2 function logs Aug 23, 2022
Copy link
Contributor

@TheIronDev TheIronDev left a comment

Choose a reason for hiding this comment

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

Lgtm!

@taeold taeold merged commit 9eb8be5 into launch.next Sep 1, 2022
@yblok13
Copy link
Contributor

yblok13 commented Jul 17, 2023

Trace property is not automatically added to logger.write().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants