Skip to content

Unify gcp resource detector#2747

Merged
jaydeluca merged 4 commits intoopen-telemetry:mainfrom
psx95:unify-gcp-resource-detector
Apr 10, 2026
Merged

Unify gcp resource detector#2747
jaydeluca merged 4 commits intoopen-telemetry:mainfrom
psx95:unify-gcp-resource-detector

Conversation

@psx95
Copy link
Copy Markdown
Contributor

@psx95 psx95 commented Apr 7, 2026

Description:

Remove the dependency on GCP Resource Detection Support Library by inlining the detection code directly in this resource detector.

Testing:

  • Existing unit tests for the resource detector pass.
  • Included the tests from the detection support library for maintaining test coverage.
  • Ran a manual test with a resource detection sample to ensure that the detected resource was not changed.

Documentation:

There should be no user-facing change since the external APIs were not affected.

@github-actions github-actions bot requested a review from jsuereth April 7, 2026 19:48
@psx95 psx95 marked this pull request as ready for review April 7, 2026 20:22
@psx95 psx95 requested a review from a team as a code owner April 7, 2026 20:22
Copilot AI review requested due to automatic review settings April 7, 2026 20:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR successfully removes the external dependency on the GCP Resource Detection Support Library (com.google.cloud.opentelemetry:detector-resources-support:0.36.0) by inlining all the detection code directly into the gcp-resources module. This is a dependency unification effort that maintains the same public APIs and functionality.

Changes:

  • Adds 11 new platform detection classes (GcpPlatformDetector, GcpMetadataConfig, EnvironmentVariables, DetectedPlatform, AttributeKeys, and platform-specific implementations) to replace the external library functionality
  • Adds 4 new test support files (TestUtils, GcpPlatformDetectorTest, GcpMetadataConfigTest, EnvVarMock) with comprehensive test coverage from the original library
  • Updates GCPResourceProvider and its tests to use the new local classes instead of external imports
  • Updates build.gradle.kts to remove the external dependency and add test dependencies (mockito-inline and wiremock-jre8)

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gcp-resources/src/main/java/.../GcpPlatformDetector.java New main platform detector class replacing the external library
gcp-resources/src/main/java/.../GcpMetadataConfig.java New metadata configuration class for fetching GCP instance attributes
gcp-resources/src/main/java/.../EnvironmentVariables.java New interface for environment variable access abstraction
gcp-resources/src/main/java/.../DetectedPlatform.java New interface defining the contract for detected platforms
gcp-resources/src/main/java/.../AttributeKeys.java New attribute keys constants
gcp-resources/src/main/java/.../Google*.java Platform-specific implementations (GCE, GKE, GAE, Cloud Run, Cloud Functions)
gcp-resources/src/main/java/.../GCPResourceProvider.java Updated to use local classes instead of external library
gcp-resources/src/test/java/.../GcpPlatformDetectorTest.java New comprehensive test suite for platform detection
gcp-resources/src/test/java/.../GcpMetadataConfigTest.java New test suite for metadata configuration
gcp-resources/src/test/java/.../TestUtils.java New test utility for stubbing endpoints
gcp-resources/build.gradle.kts Removed external dependency, added test dependencies

@jaydeluca jaydeluca added this pull request to the merge queue Apr 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 10, 2026
@jaydeluca jaydeluca added this pull request to the merge queue Apr 10, 2026
Merged via the queue into open-telemetry:main with commit 744e845 Apr 10, 2026
21 checks passed
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.

4 participants