Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always display diags in name-sorted order #4225

Merged
merged 1 commit into from
Sep 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

### Bugfixes
- [#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