Uploaded image for project: 'Hawkular Metrics'
  1. Hawkular Metrics

Exclude stats from empty bucket data points


    • Type: Enhancement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 0.15.0
    • Component/s: REST
    • Labels:


      We have some rather inconsistent behavior with how we handle empty bucket data points. A non-empty numeric bucket data point looks like:

        "start": 12345,
        "end": 6789,
        "empty": false,
        "min": 100.01,
        "avg": 107.5,
        "max": 115.32,
        "median": 109.0,
        "sum": 215.0,
        "samples": 5

      All of the statistic related properties are numeric values. When the bucket is empty though, the data point looks like:

        "start": 12345,
        "end": 6789,
        "empty": true,
        "min": "NaN",
        "avg": "NaN",
        "max": "NaN",
        "median": "NaN",
        "sum": "NaN",
        "samples": 0

      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:

        "start": 12345,
        "end": 6789,
        "empty": false,
        "downtimeDuration": 29311,
        "lastDowntime": 12367,
        "uptimeRatio": 0.78,
        "downtimeCount": 12

      The stats related properties have numeric values. Now look at an empty data point:

        "start": 12345,
        "end": 6789,
        "empty": true,
        "downtimeDuration": 0,
        "lastDowntime": 0,
        "uptimeRatio": "NaN",
        "downtimeCount": 0

      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.

        Gliffy Diagrams




              • Assignee:
                john.sanda John Sanda
                john.sanda John Sanda
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: