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

Regression: unregistering "builtin" collectors stopped working with 1.2.0 #662

Closed
costela opened this issue Oct 17, 2019 · 3 comments · Fixed by #663
Closed

Regression: unregistering "builtin" collectors stopped working with 1.2.0 #662

costela opened this issue Oct 17, 2019 · 3 comments · Fixed by #663

Comments

@costela
Copy link
Contributor

costela commented Oct 17, 2019

This simple test case showcases the problem:

func TestRegisterUnregisterCollector(t *testing.T) {
	col := prometheus.NewGoCollector()

	reg := prometheus.NewRegistry()
	reg.MustRegister(col)
	reg.Unregister(col)
	if metrics, err := reg.Gather(); err != nil {
		t.Error("error gathering sample metric")
	} else if len(metrics) != 0 {
		t.Error("should have unregistered metric")
	}
}

This passed up to v1.1.0, but fails on v1.2.0 (and master).

The calculation of collectorID got changed in 1.2.0 and the same change was not applied to unregistering. PR follows shortly.

@beorn7
Copy link
Member

beorn7 commented Oct 17, 2019

Ouch. Thanks for spotting.

Perils of code duplication. But with #663, there will be a test.

@costela
Copy link
Contributor Author

costela commented Oct 17, 2019

Happy to help! :)

@beorn7
Copy link
Member

beorn7 commented Oct 17, 2019

v1.2.1 coming.

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 a pull request may close this issue.

2 participants