Skip to content

feat: autopopulate GCF metadata #276

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

Conversation

DominicKramer
Copy link
Contributor

Fixes: #91

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 10, 2019
@DominicKramer DominicKramer added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 11, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 11, 2019
@@ -154,13 +154,25 @@ export class LoggingCommon {
entryMetadata.httpRequest = metadata.httpRequest;
}

// If running on Google Cloud Functions, add labels for the function
// name, project, and region.
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: We are special casing cloud functions here. Should we also be doing something for GAE and other managed environments? Note that we already do provide some of this information in the resource field of the LogEntry: https://github.com/googleapis/nodejs-logging/blob/34878be64cb4475e364624c5a5ea86d4f809fcff/src/log.ts#L825-L834

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, providing info for GAE would be good too. I was thinking that could be a follow-up PR, but if you think it belongs in this PR, I can add it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to know what kind of logic we need to add. Secondly, is there a way to put this logic in the common logging library rather than here? I expect the logging-bunyan also needs it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I am still investigating what information we should auto-populate from GAE. Yes, putting this in @google-cloud/logging would be better. I'll move this work there.

@DominicKramer
Copy link
Contributor Author

This needs the functionality of PR #278 to be able to add execution_id support.

@codecov
Copy link

codecov bot commented Mar 14, 2019

Codecov Report

Merging #276 into master will decrease coverage by 1.5%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
- Coverage   92.15%   90.65%   -1.51%     
==========================================
  Files           6        6              
  Lines         102      107       +5     
  Branches       18       22       +4     
==========================================
+ Hits           94       97       +3     
  Misses          4        4              
- Partials        4        6       +2
Impacted Files Coverage Δ
src/common.ts 94.23% <66.66%> (-3.65%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b53d89...058ccac. Read the comment docs.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 17, 2019
@ofrobots ofrobots added the status: blocked Resolving the issue is dependent on other work. label Mar 18, 2019
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Mar 18, 2019
@DominicKramer
Copy link
Contributor Author

This PR is no longer needed since @google-cloud/logging PR #400 correctly adds metadata, and console.log on GCF can be used to print messages that show up in the GCP Logs Viewer with the execution_id populated.

@ofrobots
Copy link
Contributor

ofrobots commented Apr 2, 2019

@DominicKramer I thought this PR was about entryMetadata.labels. googleapis/nodejs-logging#400 is about serviceContext.

@ofrobots ofrobots reopened this Apr 2, 2019
@DominicKramer
Copy link
Contributor Author

My mistake, I meant to say @google-cloud/logging PR #436 instead of PR #400.

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. status: blocked Resolving the issue is dependent on other work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants