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 an experimental googleclientauth extension #703

Merged
merged 3 commits into from
Aug 31, 2023

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Aug 9, 2023

Similar to https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/oauth2clientauthextension, but supports google application default credentials.

This extension:

  • Gets application default credentials
  • Uses project and quota project, if those are set in the credentials.
  • Ensures the user has set a project

Things I didn't do, but could have:

Testing: I don't have a way to test this right now, but it seems simple enough that it should work.

@dashpole dashpole requested a review from a team as a code owner August 9, 2023 19:03
@dashpole dashpole added the enhancement New feature or request label Aug 9, 2023
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #703 (e55d34f) into main (fff463f) will increase coverage by 0.07%.
Report is 6 commits behind head on main.
The diff coverage is 69.76%.

@@            Coverage Diff             @@
##             main     #703      +/-   ##
==========================================
+ Coverage   69.59%   69.66%   +0.07%     
==========================================
  Files          36       42       +6     
  Lines        4717     4840     +123     
==========================================
+ Hits         3283     3372      +89     
- Misses       1286     1317      +31     
- Partials      148      151       +3     
Files Changed Coverage Δ
extension/googleclientauthextension/grpc.go 0.00% <0.00%> (ø)
extension/googleclientauthextension/factory.go 71.42% <71.42%> (ø)
extension/googleclientauthextension/config.go 100.00% <100.00%> (ø)
extension/googleclientauthextension/http.go 100.00% <100.00%> (ø)

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dashpole dashpole force-pushed the gcp_oauth branch 4 times, most recently from cf5f3d7 to 4b43b08 Compare August 9, 2023 19:55
@dashpole
Copy link
Contributor Author

I think I've thought of a way to test this. We can support custom authenticators on our exporter in client config, and run integration tests using this as a source of auth

@dashpole dashpole force-pushed the gcp_oauth branch 4 times, most recently from 4895b3d to ac71b09 Compare August 11, 2023 20:44
@dashpole
Copy link
Contributor Author

I've decided not to do the integration test in this PR, so i've reverted that commit. I can do it as a follow-up, if it is needed.

@dashpole
Copy link
Contributor Author

Through the experiment with testing, I have confirmed that the extension can be used with the cloud logging, monitoring, and trace APIs.

Copy link
Contributor

@aabmass aabmass left a comment

Choose a reason for hiding this comment

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

LGTM

extension/googleclientauthextension/README.md Outdated Show resolved Hide resolved

// Attach system parameters
if ca.config.QuotaProject != "" {
metadata["X-goog-user-project"] = ca.config.QuotaProject
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dashpole dashpole merged commit e0f6140 into GoogleCloudPlatform:main Aug 31, 2023
25 checks passed
@dashpole dashpole deleted the gcp_oauth branch August 31, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants