We have some rather inconsistent behavior with how we handle empty bucket data points. A non-empty numeric bucket data point looks like:
All of the statistic related properties are numeric values. When the bucket is empty though, the data point looks like:
Rather than excluding the stats properties, we return the string NaN and zero for the samples property. We should be excluding these properties. This is what we do with collections for all other return types, and it make sense to do so here as well. It does not make sense to return a floating point value for non-empty buckets, and then return a string for empty buckets.
To make things even worse, the behavior is yet again different with availability bucket points. Here is a non-empty bucket point:
The stats related properties have numeric values. Now look at an empty data point:
We return the string NaN for the properties that have floating point values, and we return an integer zero for integer properties.
This behavior is a result of letting implementation details bleed through. We are simply returning Java's default values for the different data types involved. We should be consistent and simply exclude these properties. They serve no purpose when the bucket is empty.