screeps-grafana
screeps-grafana copied to clipboard
Handle null values in received data
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.
Are the null values handled correctly by graphite?
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
Now all values are discarded that statsd would complain about (And discard anyways).
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?
Null values are handled by graphite, counts as non value
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.
Perfect.
@AlinaNova21 Any interest in this PR? I would like to get rid of the fork