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

Create internal/metadataproviders module #10376

Merged
merged 13 commits into from
Jun 3, 2022

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented May 27, 2022

Description:

Move the metadata providers for different environments used in the resource detection processor to a new internal module.
The goal is to reduce duplication in the usage of these metadata clients among different components (namely, we want to use some of these in the Datadog exporter).

In the future, it would also be nice to handle things like retries and caching in a common way for all components, to avoid e.g. one component being able to query the AWS EC2 endpoint while another times out; but this is out of scope on this particular PR, which tries to only make minimal changes on the code moved to the new module.

Link to tracking Issue: Relates to #1379 and #10424

Testing: Original unit tests are kept

@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label May 27, 2022
@mx-psi mx-psi force-pushed the mx-psi/internal/metadataclients branch from 5e315a9 to 01d424b Compare May 27, 2022 16:42
@mx-psi mx-psi changed the title Create internal/metadataclients module Create internal/metadataproviders module May 27, 2022
@mx-psi mx-psi marked this pull request as ready for review May 27, 2022 17:15
@mx-psi mx-psi requested a review from a team May 27, 2022 17:15
@mx-psi
Copy link
Member Author

mx-psi commented Jun 1, 2022

@Aneurysm9 @pmm-sumo @dashpole would you mind having a look at this? Although the diff is large, the changes are mostly either renames or go.mod/go.sum updates, so it shouldn't take too long to review

@pmm-sumo
Copy link
Contributor

pmm-sumo commented Jun 1, 2022

I'm curious what's @bogdandrutu take on how it fits the larger vision on component relationship within the collector.

One alternative approach would be be moving the detectors into an extension. It would have pros and cons but then would be easier to refer by other components (e.g. for components outside of the contrib)

@mx-psi
Copy link
Member Author

mx-psi commented Jun 1, 2022

I'm curious what's @bogdandrutu take on how it fits the larger vision on component relationship within the collector.

One alternative approach would be be moving the detectors into an extension. It would have pros and cons but then would be easier to refer by other components (e.g. for components outside of the contrib)

@pmm-sumo I think that is a fair question (since components that use an internal module won't be able to be moved outside of this repository for now), but I don't think we need to solve this on this PR because it's not a problem specific to this new internal module: the problem existed before and we are not making it any worse by doing this (other than having a couple more components depend on internal modules, but if we are worried about that we should ban internal modules entirely I guess).

In my mind the solution eventually would be to move this new metadataproviders module into a module inside pkg/ instead, but for that we would have to carefully think about the public API and think about where do we want this to live.

Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

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

LGTM

@mx-psi
Copy link
Member Author

mx-psi commented Jun 1, 2022

Marking as ready to merge since we have two approvals, one from a CODEOWNER

@mx-psi mx-psi added the ready to merge Code review completed; ready to merge by maintainers label Jun 1, 2022
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

@mx-psi please resolve the conflicts and we can merge this

@mx-psi
Copy link
Member Author

mx-psi commented Jun 3, 2022

@codeboten Thanks for the ping, should be ready to merge now!

@codeboten codeboten merged commit c630f8f into open-telemetry:main Jun 3, 2022
kentquirk pushed a commit to McSick/opentelemetry-collector-contrib that referenced this pull request Jun 14, 2022
* [processor/resourcedetection] Move 'azure' metadata provider to internal package

* [processor/resourcedetection] Move 'docker' metadata provider to internal package

* [processor/resourcedetection] Move 'system' metadata provider to internal package

* [processor/resourcedetection] Move 'gcp' metadata provider to internal package

* [processor/resourcedetection] Move 'consul' metadata provider to internal package

* [processor/resourcedetection] Move 'ec2' metadata provider to internal package

* Add CODEOWNERS entry (same as resourcedetectionprocessor)

* add new module to versions.yaml

* Fix merge

* make gotidy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants