prometheus/util
David Kaltschmidt c93e54d240 Adds execution timer stats to the range query
API consumers should be able to get insight into the query run times.
The UI currently measures total roundtrip times. This PR allows for more
fine grained metrics to be exposed.

* adds new timer for total execution time (queue + eval)

* expose new timer, queue timer, and eval timer in stats field of the
 range query response:
```json
{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": [],
    "stats": {
      "execQueueTimeNs": 4683,
      "execTotalTimeNs": 2086587,
      "totalEvalTimeNs": 2077851
    }
  }
}
```

* stats field is optional, only set when query parameter `stats` is not
empty

Try it via
```sh
curl 'http://localhost:9090/api/v1/query_range?query=up&start=1486480279&end=1486483879&step=14000&stats=true'
```

Review feedback

* moved query stats json generation to query_stats.go
* use seconds for all query timers
* expose all timers available
* Changed ExecTotalTime string representation from Exec queue total time to Exec total time
2017-11-16 16:05:10 +01:00
..
flock Add missing license headers 2016-04-13 16:08:22 +02:00
httputil Added go-conntrack for monitoring http connections (#3241) 2017-10-06 11:22:19 +01:00
promlint Add promlint check for histogram/summary reserved names (#2626) 2017-04-15 22:38:01 +01:00
stats Adds execution timer stats to the range query 2017-11-16 16:05:10 +01:00
strutil Revert "Revert the /graph changes." 2016-09-03 21:05:23 +02:00
testutil Remote storage reads based on oldest timestamp in primary storage (#3129) 2017-10-18 12:08:14 +01:00
treecache Fix some lint errors (#3334) 2017-10-23 14:57:30 +01:00