Repository navigation
gcp-resources: detect Cloud Run functions, worker pools, and instances - #3233
Open
DylanRussell wants to merge 2 commits into
Open
DylanRussell wants to merge 2 commits into
DylanRussell wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the Cloud Run detection and worker pool support changes.
No open issues 🎉
What changed in this PR
Updates gcp-resources platform detection and resource attributes, building on #3229 to correctly identify Cloud Run functions and support Cloud Run worker pools.
Changes:
- Classifies Cloud Run functions, including Cloud Functions 2nd gen, as Cloud Run by prioritizing
K_CONFIGURATION; first-generation detection remains unchanged. - Adds worker pool detection, metadata extraction, and
cloud.resource_idvalues using theworkerPoolsresource path. - Extends tests for classification precedence, worker pool attribute mapping, optional revision, and incomplete resource IDs.
| File | Description |
|---|---|
gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/GCPResourceProviderTest.java |
Tests worker pool attribute mapping and resource-ID completeness. |
gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/GcpPlatformDetectorTest.java |
Tests function classification precedence and worker pool detection. |
gcp-resources/src/main/java/io/opentelemetry/contrib/gcp/resource/GoogleCloudRunWorkerPool.java |
Extracts worker pool name, revision, instance ID, and region. |
gcp-resources/src/main/java/io/opentelemetry/contrib/gcp/resource/GCPResourceProvider.java |
Maps worker pools to Cloud Run attributes and resource IDs. |
gcp-resources/src/main/java/io/opentelemetry/contrib/gcp/resource/GcpPlatformDetector.java |
Adjusts function classification and registers worker pool detection. |
Review effort: Balanced
This was referenced Nov 19, 2026
DylanRussell
force-pushed
the
fix-gcp-resources-cloud-run
branch
from
November 19, 2026 21:32
dac5be5 to
cf1beb6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Follow-up to #3229 (matching open-telemetry/opentelemetry-python-contrib#5363 and open-telemetry/opentelemetry-go-contrib#10350). cc @psx95
K_CONFIGURATIONbeforeFUNCTION_TARGET: Cloud Run functions (gcloud run deploy --function) and Cloud Functions (2nd gen) run as Cloud Run services and set bothK_CONFIGURATIONandFUNCTION_TARGET, whereas Cloud Functions (1st gen) only setsFUNCTION_TARGET.cloud.platform=gcp_cloud_runandcloud.resource_id=//run.googleapis.com/projects/{project}/locations/{region}/services/{name}instead ofgcp_cloud_functions. Cloud Functions (1st gen) is unchanged.CLOUD_RUN_WORKER_POOL(CLOUD_RUN_REVISION,instance/id,instance/region) per the worker pools contract asgcp_cloud_runwithcloud.resource_id=//run.googleapis.com/projects/{project}/locations/{region}/workerPools/{name}.CLOUD_RUN_INSTANCE(docs) asgcp_cloud_runwithcloud.resource_id=//run.googleapis.com/projects/{project}/locations/{region}/instances/{name}.Testing:
./gradlew :gcp-resources:spotlessCheck :gcp-resources:check --rerun-tasks --console=plain(74 tests passed, 0 failures; Spotless, ErrorProne, and NullAway checks passed).GcpPlatformDetectorTestandGCPResourceProviderTestfor Cloud Run functions precedence, worker pools, and instances.Documentation:
Existing
gcp-resources/README.mdtable already coversGCR(gcp_cloud_runandcloud.resource_id).