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: fix resource autodetection for GKE, GAE, and GCE #1070

Merged
merged 8 commits into from
May 18, 2021
Merged

Conversation

0xSage
Copy link
Contributor

@0xSage 0xSage commented May 13, 2021

Fixes #673 🦕
Fixes #125 🦕

For GKE, we infer the following after thorough discussion and research:

  • pod_name == process.env.HOSTNAME
  • namespace_name == fs/readfile() ~/var/run/secrets/kubernetes.io/serviceaccount/namespace
  • container_name is only populated if users pass it into containers as an environment variable. Not available via any downwards APIs or GCP apis for now.

Passing e2e environment tests that verify logging behavior in respective platforms:

  • prod:cloud-devrel/client-libraries/go/google-cloud-go/environment/logging/compute
  • prod:cloud-devrel/client-libraries/go/google-cloud-go/environment/logging/appengine_standard
  • prod:cloud-devrel/client-libraries/go/google-cloud-go/environment/logging/kubernetes

@0xSage 0xSage self-assigned this May 13, 2021
@generated-files-bot
Copy link

Warning: This pull request is touching the following templated files:

  • .kokoro/environment/appengine_standard.cfg - .kokoro files are templated and should be updated in synthtool
  • .kokoro/environment/compute.cfg - .kokoro files are templated and should be updated in synthtool
  • .kokoro/environment/kubernetes.cfg - .kokoro files are templated and should be updated in synthtool

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label May 13, 2021
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/nodejs-logging API. label May 13, 2021
@0xSage 0xSage added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 14, 2021
@0xSage 0xSage marked this pull request as ready for review May 17, 2021 10:50
@0xSage 0xSage requested review from a team as code owners May 17, 2021 10:50
@sebtrif
Copy link

sebtrif commented Oct 29, 2021

Heya!

Would it be possible to mention in the docs somewhere or in the readme the gotcha about CONTAINER_NAME needing to be passed via environment variables?

It's a super useful PR but I was left scratching my head for a few hours and it took looking through the source to figure out why that field alone wasn't populated :/

Thanks again for the useful PR, it makes everything combine really nicely with Cloud Monitoring since the changes!

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/nodejs-logging API. cla: yes This human has signed the Contributor License Agreement. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for populating gke container name Add Instance name in the default metadata resource labels
3 participants