Prometheus graph data endpoint uses strange response types
The response from the additional_metrics.json
endpoint used for the Prometheus environment graphs looks like this:
{
"group": "Response metrics (NGINX)",
"priority": 10,
"metrics": [
{
"title": "Throughput",
"weight": 1,
"y_label": "Requests \/ Sec",
"queries": [
{
// ...
"result": [
{
"metric": {
"status_code": "1xx"
},
"values": [
[
1507148815.371,
"0"
],
[
1507148875.371,
"0"
],
[
1507148935.371,
"23.116"
],
// ...
],
},
],
// ...
The query result includes Date/value pairs to be used in constructing the graph, however these are formatted in a strange way.
-
Why do our unix date integers include millisecond offsets like this (every one in this sample query is offset at 371 milliseconds). Why not just use an integer timestamp?
-
The "value" is represented as a string (e.g.
"0"
or"23.116"
as opposed to0
or23.116
). This was causing some peculiar bugs on the frontend (for instance,"9.356" > "23.116" === true
!) until it was corrected for, but I'm curious why these aren't just returned as numerical values in the first place.