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 internal setup package for managing file loading and registration #18

Merged
merged 3 commits into from
Nov 19, 2019

Conversation

stephen-soltesz
Copy link
Contributor

@stephen-soltesz stephen-soltesz commented Nov 19, 2019

This package will replace the registration logic in bigquery_exporter/main.go to support file reload and and prometheus registration.

Basically, the setup.File methods support writing a register-update loop like:

modified, err := f.IsModified()
if modified && err == nil {
    c := sql.NewCollector(...)
    err = f.Register(c)
} else {
    err = f.Update()
}

This change is Reviewable

Copy link
Contributor

@pboothe pboothe left a comment

Choose a reason for hiding this comment

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

These changes look good to me with one small comment.

:lgtm:, approval

That said, they do work in further support of a more-risky deployment pattern where the underlying config file can change out from underneath the running binary. It would be nice to make sure that the idea of deploying configs and binaries together as a seamless whole was on the future roadmap for most of our systems, like we do with k8s-support for the platform.

Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained


internal/setup/setup.go, line 33 at r1 (raw file):

	curr, err := fs.Stat(f.Name)
	if err != nil {
		// TODO: best way to handle this?

At least please add a log line here.

Copy link
Contributor Author

@stephen-soltesz stephen-soltesz left a comment

Choose a reason for hiding this comment

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

Yes, good point regarding binary+config deployments. That was not on my mind when I wrote this.

Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained


internal/setup/setup.go, line 33 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

At least please add a log line here.

Done.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 54

  • 33 of 33 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+4.5%) to 83.333%

Totals Coverage Status
Change from base Build 52: 4.5%
Covered Lines: 130
Relevant Lines: 156

💛 - Coveralls

@stephen-soltesz stephen-soltesz merged commit fe2203e into master Nov 19, 2019
@stephen-soltesz stephen-soltesz deleted the sandbox-soltesz-setup branch August 12, 2022 17:21
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