screeps-grafana icon indicating copy to clipboard operation
screeps-grafana copied to clipboard

Handle null values in received data

Open nama17 opened this issue 2 years ago • 6 comments

If v === null this condition is true, but we do not want that here as it causes a TypeError when Object.entries(data) is called.

nama17 avatar Oct 25 '22 18:10 nama17

Are the null values handled correctly by graphite?

glitchassassin avatar Oct 25 '22 18:10 glitchassassin

I at least get no errors from graphite as far as i can tell. Although statsd does complain about null values as well as boolean values it seems like. But stats are properly displayed in grafana nevertheless Edit: Null values never made it to graphite, statsd discards them

nama17 avatar Oct 25 '22 18:10 nama17

Now all values are discarded that statsd would complain about (And discard anyways).

nama17 avatar Oct 25 '22 20:10 nama17

Null values are handled by graphite, counts as non value

https://user-images.githubusercontent.com/93532088/198053232-e9582387-87e8-4d65-aa03-8933b1dec904.png

I think when missing data for path is also counted as null

@nama17 What you have done is filtered out all values expect numbers?

pieterbrandsen avatar Oct 26 '22 14:10 pieterbrandsen

Null values are handled by graphite, counts as non value

image

I think when missing data for path is also counted as null

@nama17 What you have done is filtered out all values expect numbers?

Yes, graphite may be able to handle null values, but statsd does not send null values to graphite in the first place, as those packets are considered invalid. See https://github.com/statsd/statsd/blob/9cf77d87855bcb69a8663135f59aa23825db9797/lib/helpers.js#L10-L12

What you also could do is use typeof to only allow numbers because I dont think bools could be allowed

Bools are already not allowed with the changes i made. I think you are right about using typeof to filter for numbers would be clearer, but i wanted to allow everything that statsd would allow while discarding everything statsd would discard as well. e.g. "2345" (as string) would be blocked when using typeof to check for a number, while statsd should accept it.

nama17 avatar Oct 26 '22 14:10 nama17

Perfect.

pieterbrandsen avatar Oct 26 '22 20:10 pieterbrandsen

@AlinaNova21 Any interest in this PR? I would like to get rid of the fork

nama17 avatar Mar 23 '23 22:03 nama17