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

Remove init functions from collectors #1112

Merged
merged 2 commits into from
Apr 1, 2023

Conversation

breed808
Copy link
Contributor

Behaviour of init functions has been centralised in collector/init.go,
and can be called during exporter startup. This allows the exporter to
control the timing of collector initialisation, rather than relying on
the import & init() method.

This should reduce unexpected behaviour arising from the use of
init(), such as #551.

@breed808 breed808 requested a review from a team as a code owner December 21, 2022 06:11
@breed808 breed808 force-pushed the remove_init branch 2 times, most recently from 98112b9 to 5d16571 Compare December 21, 2022 08:42
@breed808 breed808 added this to the v0.22.0 milestone Dec 24, 2022
@breed808 breed808 modified the milestones: v0.22.0, v0.23.0 Mar 20, 2023
@SuperQ
Copy link
Contributor

SuperQ commented Mar 25, 2023

This needs a DCO sign-off. You can use git commit -s --amend to add it.

Behaviour of init functions has been centralised in `collector/init.go`,
and can be called during exporter startup. This allows the exporter to
control the timing of collector initialisation, rather than relying on
the import & `init()` method.

This should reduce unexpected behaviour arising from the use of
`init()`, such as prometheus-community#551.

Signed-off-by: Ben Reedy <breed808@breed808.com>
Collector builder functions are only used internally in the `collector`
package, and shouldn't needlessly be exposed as part of the package API
to downstream clients.

Signed-off-by: Ben Reedy <breed808@breed808.com>
@breed808 breed808 merged commit 49afc93 into prometheus-community:master Apr 1, 2023
@breed808 breed808 deleted the remove_init branch April 1, 2023 08:17
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

2 participants