Skip to content
Snippets Groups Projects
Commit f35409c7 authored by Tom Wilkie's avatar Tom Wilkie
Browse files

Pad distinct labels to make output prettier.


Signed-off-by: default avatarTom Wilkie <tom.wilkie@gmail.com>
parent e33a029c
No related branches found
No related tags found
No related merge requests found
......@@ -93,14 +93,25 @@ func main() {
fmt.Println("Common labels:", color.RedString(commonLabels.String()))
}
maxLabelsLen := 0
for _, ls := range lss {
ls = subtract(commonLabels, ls)
len := len(ls.String())
if maxLabelsLen < len {
maxLabelsLen = len
}
}
iter := querier.NewQueryResponseIterator(&queryResponse)
for iter.Next() {
ls := labelsCache[iter.Labels()]
ls = subtract(commonLabels, ls)
labels := ls.String()
labels += strings.Repeat(" ", maxLabelsLen-len(labels))
fmt.Println(
color.BlueString(iter.Entry().Timestamp.Format(time.RFC822)),
color.RedString(ls.String()),
color.BlueString(iter.Entry().Timestamp.Format(time.RFC3339)),
color.RedString(labels),
strings.TrimSpace(iter.Entry().Line),
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment