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

Add new module for resource-detector support library #276

Merged
merged 26 commits into from
Jan 16, 2024

Conversation

psx95
Copy link
Contributor

@psx95 psx95 commented Dec 1, 2023

Separates out resource detection module into a support-library (detector-resources-support) and a mapper (detector-resources).

The mapper uses the support-library to map OTel specific resources to GCP specific resources. The support-library contains logic to detect the GCP specific resources and provided appropriate attributes for the detected resource.

The logic split has been done keeping the following in mind -

  1. The support library would not contain any Google-specific dependency (e.g. a dependency on any GCP SDK).
  2. The support library would not contain any OpenTelemetry specific dependency.
  3. The mapper library could potentially go upstream in Contribution of the resource providers to opentelemetry-java-contrib repo #266 and would take a dependency on the support-library.

Supports #266

@psx95 psx95 force-pushed the refactor-resource-detector branch from c9235af to f4e1173 Compare December 4, 2023 02:35
@psx95 psx95 force-pushed the refactor-resource-detector branch 2 times, most recently from b0a0878 to 563ea05 Compare December 12, 2023 21:50
@psx95 psx95 force-pushed the refactor-resource-detector branch 2 times, most recently from 2c2c1d6 to f8b15ae Compare December 31, 2023 20:30
@psx95 psx95 force-pushed the refactor-resource-detector branch 2 times, most recently from 7ad60e9 to eefad12 Compare January 3, 2024 22:53
@psx95 psx95 force-pushed the refactor-resource-detector branch from eefad12 to 3a48e94 Compare January 4, 2024 16:27
@psx95 psx95 force-pushed the refactor-resource-detector branch from 3a48e94 to 27184e3 Compare January 4, 2024 16:30

// Order of detection functions matters here
Stream<Function<EnvironmentVariables, Optional<SupportedPlatform>>> platforms =
Stream.of(detectGKE, detectGCR, detectGCF, detectGAE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't GCF be before GCR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not look at the spec again, but I was going by the code we already had - in which we checked for GCR before GCF.

Is there a reason why GCF should be checked before GCR ?

@psx95 psx95 force-pushed the refactor-resource-detector branch from d9c39eb to d3df7d6 Compare January 5, 2024 17:00
@psx95 psx95 force-pushed the refactor-resource-detector branch from d3df7d6 to 5c9500f Compare January 5, 2024 17:04
@psx95 psx95 force-pushed the refactor-resource-detector branch from de8d26a to 8ab8080 Compare January 5, 2024 21:14
@psx95 psx95 force-pushed the refactor-resource-detector branch from 7e8e92d to 601b4f0 Compare January 6, 2024 00:43
@psx95 psx95 marked this pull request as ready for review January 8, 2024 06:07
@psx95 psx95 requested a review from a team as a code owner January 8, 2024 06:07
@psx95 psx95 force-pushed the refactor-resource-detector branch from 0c3035c to 4d577f0 Compare January 9, 2024 21:12
Support library was using the same package as the detectors library.
This rename would avoid potential conflicts and import issues.
@psx95 psx95 force-pushed the refactor-resource-detector branch from 7b53df5 to 3ced0b9 Compare January 16, 2024 20:42
These breaking chnages can be directly introduced when we contribute the
resource detector upstream. This commit adds classes back and marks them
deprecated to indicate to the users not to depend on them.
@psx95 psx95 force-pushed the refactor-resource-detector branch from 3ced0b9 to dccc767 Compare January 16, 2024 20:53
@psx95 psx95 merged commit 60dfec0 into GoogleCloudPlatform:main Jan 16, 2024
13 checks passed
@psx95 psx95 deleted the refactor-resource-detector branch January 16, 2024 21:07
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