Timelion: why is max on integer showing digits behind decimal delimiter?

Hi,

I am visualizing an id with timelion. The id is a negative long value.
I am interesting when the reaches the value 0. I bucket per day and want to show only the max value of the bucket.

But why is timelion showing me data "more precise" than .00 on max metric with having input data in type long? How does it produce the .24 ?

Thanks, Andreas

That is curious indeed. I was unable to reproduce such an effect. Would you be able to inspect the network response of the request to /api/timelion/run and check whether the data contained in .sheet["0"].list["0"].data contains these decimal places as well? That would give an indication whether it's a pure rendering issue or not.

how can I check the network response? Is there a way to /api/timelion/run directly? If so, can I copy the query from the timelion url?
Or how can I get the results? Can it be found in the kibana logs?

In your browser you can open the developer tools (how exactly depends on your browser) to inspect the network requests. Among these there should be one to the /api/timelion/run endpoints. Here is an example using Chrome with parts of the response visible:

It could help if you pasted the response or - even better - saved the whole request as a HAR and attach it to your answer for me to inspect:

here is the output:

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "WebInspector",
      "version": "537.36"
    },
    "pages": [],
    "entries": [
      {
        "startedDateTime": "2017-02-21T12:25:55.000Z",
        "time": 658.5840000770986,
        "request": {
          "method": "POST",
          "url": "https://myserver/kibana5/api/timelion/run",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Authorization",
              "value": "Basic bG9naXdlYl9raWJhbmE1OmxvZ2kyV2Vi"
            },
            {
              "name": "Origin",
              "value": "https://myserver"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Host",
              "value": "myserver"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.8"
            },
            {
              "name": "kbn-version",
              "value": "5.1.2"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.88 Safari/537.36 Vivaldi/1.7.735.46"
            },
            {
              "name": "Content-Type",
              "value": "application/json;charset=UTF-8"
            },
            {
              "name": "Accept",
              "value": "application/json, text/plain, */*"
            },
            {
              "name": "Referer",
              "value": "https://myserver/kibana5/app/timelion"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Content-Length",
              "value": "324"
            }
          ],
          "queryString": [],
          "cookies": [],
          "headersSize": 570,
          "bodySize": 324,
          "postData": {
            "mimeType": "application/json;charset=UTF-8",
            "text": "{\"sheet\":[\".es(q=\\\"type: HL_messageDelay\\\",metric=\\\"max:tkmMsdId\\\").trend(linear).label(\\\"trend\\\").color(darkred).lines(width=1),.es(q=\\\"type: HL_messageDelay\\\",metric=\\\"max:tkmMsdId\\\").label(\\\"currentID\\\").range(-650000000,0)\"],\"time\":{\"from\":\"now/M\",\"to\":\"now/M\",\"mode\":\"quick\",\"interval\":\"1d\",\"timezone\":\"Europe/Berlin\"}}"
          }
        },
        "response": {
          "status": 200,
          "statusText": "OK",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Date",
              "value": "Tue, 21 Feb 2017 12:25:55 GMT"
            },
            {
              "name": "content-encoding",
              "value": "gzip"
            },
            {
              "name": "vary",
              "value": "accept-encoding"
            },
            {
              "name": "kbn-version",
              "value": "5.1.2"
            },
            {
              "name": "Transfer-Encoding",
              "value": "chunked"
            },
            {
              "name": "content-type",
              "value": "application/json; charset=utf-8"
            },
            {
              "name": "cache-control",
              "value": "no-cache"
            },
            {
              "name": "kbn-name",
              "value": "kibana"
            },
            {
              "name": "Connection",
              "value": "close"
            }
          ],
          "cookies": [],
          "content": {
            "size": 1948,
            "mimeType": "application/json",
            "compression": 1154,
            "text": "{\"sheet\":[{\"type\":\"seriesList\",\"list\":[{\"data\":[[1485903600000,-643077514.3099976],[1485990000000,-639931658.9850693],[1486076400000,-636785803.660141],[1486162800000,-633639948.3352051],[1486249200000,-630494093.0102768],[1486335600000,-627348237.6853485],[1486422000000,-624202382.3604202],[1486508400000,-621056527.0354843],[1486594800000,-617910671.710556],[1486681200000,-614764816.3856277],[1486767600000,-611618961.0606918],[1486854000000,-608473105.7357635],[1486940400000,-605327250.4108353],[1487026800000,-602181395.085907],[1487113200000,-599035539.7609711],[1487199600000,-595889684.4360428],[1487286000000,-592743829.1111145],[1487372400000,-589597973.7861786],[1487458800000,-586452118.4612503],[1487545200000,-583306263.136322],[1487631600000,-580160407.8113937],[1487718000000,-577014552.4864578],[1487804400000,-573868697.1615295],[1487890800000,-570722841.8366013],[1487977200000,-567576986.5116653],[1488063600000,-564431131.1867371],[1488150000000,-561285275.8618088],[1488236400000,-558139420.5368805]],\"type\":\"series\",\"fit\":\"nearest\",\"label\":\"trend\",\"color\":\"darkred\",\"lines\":{\"lineWidth\":1}},{\"data\":[[1485903600000,0],[1485990000000,0],[1486076400000,0],[1486162800000,0],[1486249200000,0],[1486335600000,0],[1486422000000,0],[1486508400000,0],[1486594800000,0],[1486681200000,0],[1486767600000,0],[1486854000000,0],[1486940400000,-650000000],[1487026800000,-645266940.3913833],[1487113200000,-640534418.0006387],[1487199600000,-635820164.2280139],[1487286000000,-631376839.4877902],[1487372400000,-629944412.2409157],[1487458800000,-629262314.62775],[1487545200000,-624754506.6203822],[1487631600000,-621991017.2199665],[1487718000000,0],[1487804400000,0],[1487890800000,0],[1487977200000,0],[1488063600000,0],[1488150000000,0],[1488236400000,0]],\"type\":\"series\",\"fit\":\"nearest\",\"label\":\"currentID\"}]}],\"stats\":{\"invokeTime\":1487679955082,\"queryCount\":2,\"queryTime\":1487679955638,\"cacheCount\":1,\"sheetTime\":1487679955648}}"
          },
          "redirectURL": "",
          "headersSize": 260,
          "bodySize": 794,
          "_transferSize": 1054
        },
        "cache": {},
        "timings": {
          "blocked": 0.796000007539988,
          "dns": 0.508000142872332,
          "connect": 27.27699978277088,
          "send": 0.28700008988380077,
          "wait": 628.463000059128,
          "receive": 1.2529999949035755,
          "ssl": 25.71200020611284
        },
        "serverIPAddress": "x.x.x.x",
        "connection": "920095"
      }
    ]
  }
}

Thank you for providing the request details. It looks like the values are already calculated like this on the server side. So if it's not too much trouble I would like to take a look at the actual aggregation response from Elasticsearch. Would you mind running the following query in the Kibana Dev Tools and paste the result?

GET _search
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1485903600000,
              "lte": 1488322799999,
              "format": "epoch_millis"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "q": {
      "meta": {
        "type": "split"
      },
      "filters": {
        "filters": {
          "type:HL_messageDelay": {
            "query_string": {
              "query": "type:HL_messageDelay"
            }
          }
        }
      },
      "aggs": {
        "time_buckets": {
          "meta": {
            "type": "time_buckets"
          },
          "date_histogram": {
            "field": "@timestamp",
            "interval": "1d",
            "time_zone": "Europe/Berlin",
            "extended_bounds": {
              "min": 1485903600000,
              "max": 1488322799999
            },
            "min_doc_count": 0
          },
          "aggs": {
            "max(tkmMsdId)": {
              "max": {
                "field": "tkmMsdId"
              }
            }
          }
        }
      }
    }
  }
}

here are the results. As I see it, there are only long numbers.

{
  "took": 10035,
  "timed_out": false,
  "_shards": {
    "total": 101,
    "successful": 101,
    "failed": 0
  },
  "hits": {
    "total": 53597737,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "q": {
      "meta": {
        "type": "split"
      },
      "buckets": {
        "type:HL_messageDelay": {
          "doc_count": 36057,
          "time_buckets": {
            "meta": {
              "type": "time_buckets"
            },
            "buckets": [
              {
                "key_as_string": "2017-01-31T23:00:00.000Z",
                "key": 1485903600000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-01T23:00:00.000Z",
                "key": 1485990000000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-02T23:00:00.000Z",
                "key": 1486076400000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-03T23:00:00.000Z",
                "key": 1486162800000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-04T23:00:00.000Z",
                "key": 1486249200000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-05T23:00:00.000Z",
                "key": 1486335600000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-06T23:00:00.000Z",
                "key": 1486422000000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-07T23:00:00.000Z",
                "key": 1486508400000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-08T23:00:00.000Z",
                "key": 1486594800000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },
              {
                "key_as_string": "2017-02-09T23:00:00.000Z",
                "key": 1486681200000,
                "doc_count": 0,
                "max(tkmMsdId)": {
                  "value": null
                }
              },

...

...

  {
    "key_as_string": "2017-02-10T23:00:00.000Z",
    "key": 1486767600000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-11T23:00:00.000Z",
    "key": 1486854000000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-13T00:00:00.000+01:00",
    "key": 1486940400000,
    "doc_count": 3,
    "max(tkmMsdId)": {
      "value": -607388579
    }
  },
  {
    "key_as_string": "2017-02-14T00:00:00.000+01:00",
    "key": 1487026800000,
    "doc_count": 5181,
    "max(tkmMsdId)": {
      "value": -602965800
    }
  },
  {
    "key_as_string": "2017-02-15T00:00:00.000+01:00",
    "key": 1487113200000,
    "doc_count": 4553,
    "max(tkmMsdId)": {
      "value": -598543523
    }
  },
  {
    "key_as_string": "2017-02-16T00:00:00.000+01:00",
    "key": 1487199600000,
    "doc_count": 3461,
    "max(tkmMsdId)": {
      "value": -594138317
    }
  },
  {
    "key_as_string": "2017-02-17T00:00:00.000+01:00",
    "key": 1487286000000,
    "doc_count": 4385,
    "max(tkmMsdId)": {
      "value": -589986279
    }
  },
  {
    "key_as_string": "2017-02-18T00:00:00.000+01:00",
    "key": 1487372400000,
    "doc_count": 5196,
    "max(tkmMsdId)": {
      "value": -588647756
    }
  },
  {
    "key_as_string": "2017-02-19T00:00:00.000+01:00",
    "key": 1487458800000,
    "doc_count": 2586,
    "max(tkmMsdId)": {
      "value": -588010374
    }
  },
  {
    "key_as_string": "2017-02-20T00:00:00.000+01:00",
    "key": 1487545200000,
    "doc_count": 3664,
    "max(tkmMsdId)": {
      "value": -583798080
    }
  },
  {
    "key_as_string": "2017-02-21T00:00:00.000+01:00",
    "key": 1487631600000,
    "doc_count": 5191,
    "max(tkmMsdId)": {
      "value": -579310350
    }
  },
  {
    "key_as_string": "2017-02-22T00:00:00.000+01:00",
    "key": 1487718000000,
    "doc_count": 1837,
    "max(tkmMsdId)": {
      "value": -578233765
    }
  },
  {
    "key_as_string": "2017-02-22T23:00:00.000Z",
    "key": 1487804400000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-23T23:00:00.000Z",
    "key": 1487890800000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-24T23:00:00.000Z",
    "key": 1487977200000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-25T23:00:00.000Z",
    "key": 1488063600000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-26T23:00:00.000Z",
    "key": 1488150000000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
    }
  },
  {
    "key_as_string": "2017-02-27T23:00:00.000Z",
    "key": 1488236400000,
    "doc_count": 0,
    "max(tkmMsdId)": {
      "value": null
}
  }
]
  }
}
  }
}
  }
}

Thanks, that might help to narrow it down. The analysis might take some time though.

After looking hard at your query and the pure aggregation results I think the culprit is the .range(lower_bound, upper_bound) expression, which does not do what I guess you think it does:

Changes the max and min of a series while keeping the same shape

You probably expect it to cut off values outside of the interval from -650000000 to 0. But it actually scales the series such that its minimum and maximum values match the values given to .range(lower_bound, upper_bound). That scaling might obviously lead to decimal places for interpolated values.

If you want to clamp your series to a range without scaling it, maybe try a combination of .min(upper_bound) and .max(lower_bound) as in

.es(q="type:HL_messageDelay",metric="max:tkmMsdId").max(-650000000).min(0)

Would that work for you as expected?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.