Skip to content

Commit

Permalink
Merge pull request #4225 from influxdb/sort_diags
Browse files Browse the repository at this point in the history
Always display diags in name-sorted order
  • Loading branch information
otoolep committed Sep 25, 2015
2 parents 1fc61a4 + 99989df commit c85d549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
### Bugfixes
- [#4166](https://github.com/influxdb/influxdb/pull/4166): Fix parser error on invalid SHOW
- [#3457](https://github.com/influxdb/influxdb/issues/3457): [0.9.3] cannot select field names with prefix + "." that match the measurement name
- [#4225](https://github.com/influxdb/influxdb/pull/4225): Always display diags in name-sorted order
- [#4111](https://github.com/influxdb/influxdb/pull/4111): Update pre-commit hook for go vet composites
- [#4136](https://github.com/influxdb/influxdb/pull/4136): Return an error-on-write if target retention policy does not exist. Thanks for the report @ymettier
- [#4124](https://github.com/influxdb/influxdb/issues/4124): Missing defer/recover/panic idiom in HTTPD service
Expand Down
14 changes: 11 additions & 3 deletions monitor/statement_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package monitor

import (
"fmt"
"sort"

"github.com/influxdb/influxdb/influxql"
"github.com/influxdb/influxdb/models"
Expand Down Expand Up @@ -58,15 +59,22 @@ func (s *StatementExecutor) executeShowDiagnostics(module string) *influxql.Resu
}
rows := make([]*models.Row, 0, len(diags))

for k, v := range diags {
// Get a sorted list of diagnostics keys.
sortedKeys := make([]string, 0, len(diags))
for k, _ := range diags {
sortedKeys = append(sortedKeys, k)
}
sort.Strings(sortedKeys)

for _, k := range sortedKeys {
if module != "" && k != module {
continue
}

row := &models.Row{Name: k}

row.Columns = v.Columns
row.Values = v.Rows
row.Columns = diags[k].Columns
row.Values = diags[k].Rows
rows = append(rows, row)
}
return &influxql.Result{Series: rows}
Expand Down

0 comments on commit c85d549

Please sign in to comment.