What is the meaning of null value?

Been plotting things with Grafana with prometheus as datasource. One thing that i am not really clear about is null and Nan values. I wonder:

  1. What is the meaning of null in prometheus ?
  2. When can a time series return the value null ?
  3. Is the value null the same as NaN ?
  4. In grafana, graph panel, we can interpret null as zero, as null, or connected ? What does that mean exactly ?

Been plotting things with Grafana with prometheus as datasource. One thing
that i am not really clear about is null and Nan values. I wonder:

  1. What is the meaning of null in prometheus ?

I can’t answer that because I’m not familiar with Prometheus, but hopefully
someone else can.

  1. When can a time series return the value null ?

When there is no value (result) for the time period covered by the query.

Either the query has asked for a period when there was not intended to be a
measurement, or maybe a measurement failed or went missing and just isn’t in
the database.

  1. Is the value null the same as NaN ?

I thought NaN (not a number) was something Python-specific (although
https://en.wikipedia.org/wiki/NaN clearly proves me wrong about this), and I’d
say “no, it’s not the same as null” because null means “nothing”, whereas
“NaN” means “not a number”, but it could still be something else which isn’t
“nothing”. “Null” is more specific to me than “NaN”, because “null” means
“there is no information”, whereas “NaN” could mean “oranges”.

  1. In grafana, graph panel, we can interpret null as zero, as null, or
    connected ? What does that mean exactly ?

“Null as zero” means “if you get a null value, substitute zero and use that as
the value for this time sample”.

“Null as null” means “if you get a null value, substitute nothing - it’s
null”. Most graphs will leave a gap between the preceding and succeeding data
points in this case.

“Connected” means “if you get a null value, join the preceding and succeeding
values with a straight line, effectively pretenting that you didn’t expect to
get a measurement where the null appeared”.

Regards,

Antony.

1 Like