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

Using google sdk to discover the project ID if it was not provided #62

Merged

Conversation

dcaba
Copy link
Contributor

@dcaba dcaba commented Oct 18, 2019

Hi @frodenas !

thanks so much for developing this exporter! Potential minor contribution:

  • rather than requiring a explicit project ID, if the exporter is running in GCloud, we can use google SDK to identify the current project.

  • That makes the google.project-id flag no longer required (but we will error and exit if we are unable to identify it successfully).

  • We also identified an unnecessary check in the main (for another argument - you are already marking it as required in the flags package you are using)

  • Creating also a go module for dependency management so, with go 1.11 or newer, dependencies are automatically fetched.

    • Vendored files also updated, as tests were no longer passing: one prometheus change required a minor amend in the handler registration

    Best!

@dcaba dcaba changed the title Using the sdk to discover the project ID if it was not provided Using google sdk to discover the project ID if it was not provided Oct 21, 2019
stackdriver_exporter.go Outdated Show resolved Hide resolved
@SuperQ
Copy link
Contributor

SuperQ commented Apr 10, 2020

Please rebase this against master now that we've merged go modules support in.

@dcaba dcaba force-pushed the exporterDiscoveringProjectIDInGCloud branch 2 times, most recently from ce4d76f to 7d36c1c Compare April 14, 2020 15:34
@dcaba
Copy link
Contributor Author

dcaba commented Apr 14, 2020

Please rebase this against master now that we've merged go modules support in.

Done @SuperQ !

@dcaba
Copy link
Contributor Author

dcaba commented May 14, 2020

Hi @SuperQ ! Is there interest on getting this merged? If yes, happy to rebase again

@SuperQ
Copy link
Contributor

SuperQ commented Jun 6, 2020

Yes, sorry for the moving target on master, please rebase.

@dcaba dcaba force-pushed the exporterDiscoveringProjectIDInGCloud branch 2 times, most recently from 7b7d556 to 494d9ee Compare June 9, 2020 17:45
@dcaba dcaba marked this pull request as draft June 9, 2020 17:47
@dcaba
Copy link
Contributor Author

dcaba commented Jun 9, 2020

Despite I adapted some aspects to the new shape (logger, handlers..), I may need to revisit some things

…covery, we want that to be defined at boottime, blocking the startup if needed, rather than doing it on each collector creation / handler. Simple project-id discovery logic using the gcloud sdk

Signed-off-by: Daniel Caballero <dcaballero@fastly.com>
@dcaba dcaba force-pushed the exporterDiscoveringProjectIDInGCloud branch from 494d9ee to b8e448f Compare June 9, 2020 18:14
Signed-off-by: Daniel Caballero <dcaballero@fastly.com>
@dcaba dcaba marked this pull request as ready for review June 9, 2020 18:24
@dcaba
Copy link
Contributor Author

dcaba commented Jun 9, 2020

@SuperQ , new try / rebased and adapted to your new code. I had to rollback one flag definition you moved to the collector, as the projectID is something that, with this addition, becomes dynamic (we dont want to execute the projectID discovery logic on each collector creation / handler logic), and we want to check it during the initial program bootstrap. Feel free to share feedback or request changes. Best!

Signed-off-by: Daniel Caballero <dcaballero@fastly.com>
@SuperQ
Copy link
Contributor

SuperQ commented Jun 9, 2020

Yup, that flag move makes sense.

Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@SuperQ SuperQ merged commit 53a5aea into prometheus-community:master Jun 9, 2020
@psalaberria002
Copy link

Hei! When can we expect a release for this feature?

SuperQ added a commit that referenced this pull request Jun 28, 2020
* [FEATURE] Autodiscover Google Poject ID #62

Signed-off-by: Ben Kochie <superq@gmail.com>
@SuperQ SuperQ mentioned this pull request Jun 28, 2020
SuperQ added a commit that referenced this pull request Jun 29, 2020
* [FEATURE] Autodiscover Google Poject ID #62

Signed-off-by: Ben Kochie <superq@gmail.com>
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.

None yet

3 participants