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

Cloudwatch metrics are accumulating on every Send() call, but should be Reset #590

Closed
feliksik opened this issue Jul 31, 2017 · 4 comments
Closed

Comments

@feliksik
Copy link
Contributor

On a call to cloudwatch.Send(), the state of the counter is not reset.
That means the value is always increasing.

This doesn't make sense to me, as Cloudwatch accumulates the values for you. It seems like we are basically implementing a counter with a Gauge-like behavior now.

Can we agree this is a bug?

@feliksik
Copy link
Contributor Author

See PR #591 for a failing test case.

@feliksik
Copy link
Contributor Author

I'm also not sure how the Histogram values are supposed to be reset.

Furthermore, note that if we move the test to teststat.TestCounter(), more (but not all) services fail. The still-succesful tests show which implementations use Reset().Walk().

$ go test ./metrics/...
ok  	github.com/go-kit/kit/metrics	0.253s
--- FAIL: TestCounter (0.00s)
	cloudwatch_test.go:81: Using counter second time: want 4641.000000, have 5978.000000
FAIL
FAIL	github.com/go-kit/kit/metrics/cloudwatch	0.086s
?   	github.com/go-kit/kit/metrics/discard	[no test files]
ok  	github.com/go-kit/kit/metrics/dogstatsd	0.761s
--- FAIL: TestCounter (0.00s)
	expvar_test.go:14: Using counter second time: want 4641.000000, have 5978.000000
FAIL
FAIL	github.com/go-kit/kit/metrics/expvar	0.077s
--- FAIL: TestCounter (0.00s)
	generic_test.go:25: Using counter second time: want 4641.000000, have 5978.000000
FAIL
FAIL	github.com/go-kit/kit/metrics/generic	0.680s
ok  	github.com/go-kit/kit/metrics/graphite	0.051s
ok  	github.com/go-kit/kit/metrics/influx	0.122s
ok  	github.com/go-kit/kit/metrics/internal/lv	0.002s
?   	github.com/go-kit/kit/metrics/internal/ratemap	[no test files]
ok  	github.com/go-kit/kit/metrics/multi	0.012s
--- FAIL: TestCounter (0.00s)
	pcp_test.go:26: Using counter second time: want 4641.000000, have 5978.000000
FAIL
FAIL	github.com/go-kit/kit/metrics/pcp	1.606s
--- FAIL: TestCounter (0.00s)
	prometheus_test.go:47: Using counter second time: want 4641.000000, have 5978.000000
--- FAIL: TestHistogram (0.02s)
	prometheus_test.go:186: Bucket 425: want 16, have 10 (37.5%)
FAIL
FAIL	github.com/go-kit/kit/metrics/prometheus	0.069s
?   	github.com/go-kit/kit/metrics/provider	[no test files]
ok  	github.com/go-kit/kit/metrics/statsd	0.176s
?   	github.com/go-kit/kit/metrics/teststat	[no test files]

@peterbourgon
Copy link
Member

Histograms don't need to be reset.

@peterbourgon
Copy link
Member

This is closed now, I think! :)

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

No branches or pull requests

2 participants