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

feat: add cloud function autodetection #533

Closed
wants to merge 2 commits into from

Conversation

simonz130
Copy link

  • Adds Cloud Function auto-detection. Currently relies on environment variables

@simonz130 simonz130 requested review from a team as code owners May 19, 2021 07:15
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label May 19, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label May 19, 2021
@simonz130 simonz130 self-assigned this May 21, 2021
@google-cla
Copy link

google-cla bot commented Sep 22, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 22, 2021
@minherz minherz self-requested a review September 22, 2021 10:50
@minherz
Copy link
Contributor

minherz commented Sep 22, 2021

@googlebot I consent.

@google-cla google-cla bot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 22, 2021
@@ -216,6 +227,12 @@ private static String getValue(Label label, String resourceType) {

/* Detect monitored Resource type using environment variables, else return global as default. */
private static Resource getAutoDetectedResourceType() {

// TODO detect the function from metadata server. If not available - use env var
if (System.getenv("FUNCTION_NAME") != null) {
Copy link
Contributor

@minherz minherz Sep 22, 2021

Choose a reason for hiding this comment

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

The public documentation does not describe it but a quick test discovers the following environment variables set (for golang environment): K_REVISION, GCF_BLOCK_RUNTIME_go112, GCF_BLOCK_RUNTIME_nodejs6, K_SERVICE, FUNCTION_TARGET, FUNCTION_SIGNATURE_TYPE. There is no FUNCTION_NAME environment variable.

@minherz
Copy link
Contributor

minherz commented Oct 12, 2021

Duplicates #708

@minherz minherz closed this Oct 12, 2021
@minherz minherz deleted the functionsResourceDetection branch October 18, 2021 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants