app/vlogscli: return back sorting result fields by name

This simplifies locating the needed field when the number of fields per each returned result is big
This commit is contained in:
Aliaksandr Valialkin 2024-10-07 10:39:07 +02:00
parent 18dd4105be
commit daad96b3a5
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 5 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io"
"sort"
"sync"
)
@ -120,6 +121,10 @@ func writeJSONObject(w io.Writer, kvs []kv) error {
return nil
}
sort.Slice(kvs, func(i, j int) bool {
return kvs[i].key < kvs[j].key
})
fmt.Fprintf(w, "{\n")
if err := writeJSONObjectKeyValue(w, kvs[0]); err != nil {
return err

View file

@ -18,8 +18,6 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
* FEATURE: [vlogscli](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/): preserve `less` output after the exit from scrolling mode. This should help re-using previous query results in subsequent queries.
* FEATURE: add [`len` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#len-pipe) for calculating the length for the given [log field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model) value in bytes.
* BUGFIX: [vlogscli](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/): preserve the original order of fields in the displayed query responses. Previously fields were sorted by name.
## [v0.33.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.33.0-victorialogs)
Released at 2024-10-01