Cumulative gauges#626
Conversation
| class CumulativePointLong(gauge.GaugePointLong): | ||
| """A `GaugePointLong` that cannot decrease.""" | ||
|
|
||
| def set(self, val): |
There was a problem hiding this comment.
We don't need a set method for Cumulative. See census-instrumentation/opencensus-java#1853.
There was a problem hiding this comment.
21ad4b2 leaves the class hierarchy in place, but means DerivedGaugePoint now calls the hidden _set method. Another option is to flatten these classes out -- have separate classes for derived gauges and cumulatives and duplicate some code.
| :param val: Value to set. | ||
| """ | ||
| def _set(self, val): | ||
| if not isinstance(val, six.integer_types): |
There was a problem hiding this comment.
Or consider just raising an error saying set is not supported with cumulative?
There was a problem hiding this comment.
I'd still have to split this up since the derived point wrapper is calling set on both, but I may be missing you point here. In any case I think it's fine as-is, and we can refactor this if gauges and cumulatives drift further apart.
This PR adds support for cumulative gauges, i.e. gauges that can't decrease.
See PRs for the same feature in the go and java clients.
See previous gauge PRs for some context on the mixin black magic we're using in this module: #494, #498, #503.
Fixes #586.