-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[statsd] Convert counters to floats #1978
Comments
we took a few weeks to debug this issue. It was brutal.
in practice if you write gauges & counters & timers to the same measurement it causes the data type Off the top of my head, with no idea of whats best these are the possible solutions:
|
A measurement can have fields with different data types, but the type must remain the same for each field. The example metric
But if you send a gauge and counter it is a problem
Since these have the same field The proposal above will have minimal impact since it is opt in, but it may be difficult to transition to floats if you have existing data, and you still overwrite the data point by mistake. I think ideally the metric would look something like this:
I think statsd is technically supposed to be ints, though the spec is not very tight, so it either makes sense to send in floats or have it be configurable by metric type. |
Was this ever resolved? I have some issues where some metrics from statsd are handled as int in some cases but mostly as float (for the same metric). This causing issues since I'm loosing stats. |
@jryberg It has not been resolved yet. The best way to deal with this currently is not to send any stats that map to the same measurement but have different types. |
I'm not the maintainer of this project anymore, please ping @danielnelson instead |
@skyrocknroll If you would like to implement the solution kostasb suggested we can merge it, but don't add the bit about changing the type in future versions, I'm not sure if this is the right approach. I think the best solution for storing different metric types with the same measurement is to rename the default field names. To do this, we need make a larger change like what I proposed above, perhaps introducing a @jryberg I should have said this in my last comment, but you can use the template option to set the field names to avoid conflicts, this will allow you to have a measurement with multiple fields. |
what about an option to name the field for counters and gauges? this could default to "value" like it does today but then would allow for a blanket override that works for the various combinations in place today. For example |
Sending a float value counter is cast to an int. This does not match the statsd spec.
Is there a work around for "Float value counters being cast to integer" issue? |
I don't believe there is a way to workaround the integer counters. |
Thanks for the quick reply, @danatinflux The change and PR seem like they would be straightforward, as the code currently forces int casting, however some comments here mention it would be a breaking change? Not sure how that's the case. |
In InfluxDB it isn't easy to switch from a integer field type to a float field type, it can only be done at a shard boundary which come around only every several days. So we would need this to be an opt-in feature, at least until the next major release (2.x). |
Would it be safe and sane to always cast and store it as a float then? Assuming we wrap this change with opt-in flag. |
Yes I think so |
By default counters are stored as ints. However, if a user is using a value as both a float or a int it can lead to type conflicts. This maintains the interal representation as an int to avoid messing with the caching code, but allows the counter to be reported as a float when a metric is reported. fixes: influxdata#1978
Proposal:
Emit statsd counter values as float instead of int in Line protocol.
Current behavior:
Counters are emitted as integers while gauges are emitted as floats.
This causes a type conflict in InfluxDB when trying to store a counter and a gauge in the same field. It also makes it impossible to send floating increments to counters.
Desired behavior:
Convert statsd counters from ints to floats in Line Protocol.
Because this is a breaking change, it makes sense to make it configurable in the statsd plugin level, with default value to false:
@sparrc
The text was updated successfully, but these errors were encountered: