Merge pull request #7549 from influxdata/js-7548-show-queries-shows-wrong-units

Fix output duration units for SHOW QUERIES
pull/7550/head
Jonathan A. Sternberg 2016-10-31 13:27:34 -05:00 committed by GitHub
commit 6f57448b73
2 changed files with 10 additions and 8 deletions

View File

@ -65,6 +65,7 @@ The following configuration changes in the `[data]` section may need to changed
- [#7053](https://github.com/influxdata/influxdb/issues/7053): Delete statement returns an error when retention policy or database is specified
- [#7494](https://github.com/influxdata/influxdb/issues/7494): influx_inspect: export does not escape field keys.
- [#7526](https://github.com/influxdata/influxdb/issues/7526): Truncate the version string when linking to the documentation.
- [#7548](https://github.com/influxdata/influxdb/issues/7548): Fix output duration units for SHOW QUERIES.
## v1.0.2 [2016-10-05]

View File

@ -95,15 +95,16 @@ func (t *TaskManager) executeShowQueriesStatement(q *ShowQueriesStatement) (mode
for id, qi := range t.queries {
d := now.Sub(qi.startTime)
var ds string
if d == 0 {
ds = "0s"
} else if d < time.Second {
ds = fmt.Sprintf("%du", d)
} else {
ds = (d - (d % time.Second)).String()
switch {
case d >= time.Second:
d = d - (d % time.Second)
case d >= time.Millisecond:
d = d - (d % time.Millisecond)
case d >= time.Microsecond:
d = d - (d % time.Microsecond)
}
values = append(values, []interface{}{id, qi.query, qi.database, ds})
values = append(values, []interface{}{id, qi.query, qi.database, d.String()})
}
return []*models.Row{{