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

fix(logging): allow nil zones in resource autodetection #3997

Merged
merged 2 commits into from May 3, 2021
Merged

Conversation

0xSage
Copy link
Contributor

@0xSage 0xSage commented Apr 23, 2021

fixes #3990

@0xSage 0xSage requested review from a team as code owners Apr 23, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Apr 23, 2021
@0xSage 0xSage self-assigned this Apr 23, 2021
@product-auto-label product-auto-label bot added the api: logging Issues related to the Cloud Logging API. label Apr 23, 2021
if cutoff > 0 {
return zone[:cutoff]
}
return zone
Copy link
Member

@codyoss codyoss Apr 23, 2021

Choose a reason for hiding this comment

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

If this value is not what is expected should we put zone in at all? Or just ""?

Copy link
Contributor

@someone1 someone1 Apr 30, 2021

Choose a reason for hiding this comment

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

Maybe I can help out here, in my experience, passing in the values causing this to panic (e.g. us16) will work and be accepted by Cloud Logging. I've been using my own autodetect code to stand up our logging client which does this and have had no issues logging:

image

Copy link
Contributor Author

@0xSage 0xSage May 3, 2021

Choose a reason for hiding this comment

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

We should accept any user specified/custom zones. Per user docs:
CommonResource sets the monitored resource associated with all log entries written from a Logger. If not provided, the resource is automatically detected based on the running environment (on GCE, GCR, GCF and GAE Standard only). This value can be overridden per-entry by setting an Entry's Resource field.

@0xSage
Copy link
Contributor Author

0xSage commented May 3, 2021

@codyoss , can I bug you for a stampy stamp on this one?

codyoss
codyoss approved these changes May 3, 2021
Copy link
Member

@codyoss codyoss left a comment

Lgtm

@0xSage 0xSage merged commit aded90b into master May 3, 2021
3 checks passed
@0xSage 0xSage deleted the fix3990 branch May 3, 2021
@0xSage
Copy link
Contributor Author

0xSage commented May 3, 2021

Lgtm

oh wow, thank you for taking a look on your weekend Cody

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 Cloud 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.

logging: panic in resource dection for Cloud Functions
3 participants