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

Fix Nolabels parse metrics #863

Merged
merged 1 commit into from
Aug 9, 2019
Merged
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
7 changes: 4 additions & 3 deletions cmd/logcli/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/grafana/loki/pkg/querier"

"github.com/fatih/color"
promlabels "github.com/prometheus/prometheus/pkg/labels"
)

func tailQuery(out output.LogOutput) {
Expand All @@ -35,6 +36,7 @@ func tailQuery(out output.LogOutput) {
}

labels := ""
parsedLabels := promlabels.Labels{}
for _, stream := range tailReponse.Streams {
if !*noLabels {

Expand All @@ -53,14 +55,13 @@ func tailQuery(out output.LogOutput) {
labels = ls.String()

} else {

labels = stream.Labels
}
parsedLabels = mustParseLabels(labels)
}

for _, entry := range stream.Entries {
lbls := mustParseLabels(labels)
fmt.Println(out.Format(entry.Timestamp, &lbls, 0, entry.Line))
fmt.Println(out.Format(entry.Timestamp, &parsedLabels, 0, entry.Line))
}

}
Expand Down