Skip to content

feat(gcp-detector): add Cloud Run support with faas.* #1

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

Merged
merged 4 commits into from
May 9, 2025

Conversation

kaspernissen
Copy link
Collaborator

Which problem is this PR solving?

The GCP resource detector for Node.js did not previously support Cloud Run–specific resource attributes, although these are supported in other SDKs (e.g. Go, Java). This PR adds support for setting the faas.* attributes when running in a Cloud Run environment.

Short description of the changes

  • Detects faas.name from K_SERVICE environment variable
  • Detects faas.version from K_REVISION environment variable
  • Detects faas.instance from GCP metadata server (/instance/id)
  • Adds unit test for Cloud Run detection, following existing patterns
  • Keeps full backward compatibility and aligns behavior with the Go SDK implementation (using env vars when guaranteed)

…n, and faas.instance

Signed-off-by: Kasper Borg Nissen <[email protected]>
Signed-off-by: Kasper Borg Nissen <[email protected]>
@kaspernissen kaspernissen force-pushed the feat/gcp-detector-cloud-run-support branch from 38cf6c5 to 7c14194 Compare May 2, 2025 08:44
@kaspernissen kaspernissen merged commit 44433fa into main May 9, 2025
2 checks passed
@kaspernissen kaspernissen deleted the feat/gcp-detector-cloud-run-support branch May 9, 2025 11:28
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.

1 participant