Skip to content

Commit

Permalink
fix(logcli): create new tail response for every line
Browse files Browse the repository at this point in the history
When tailing with logcli, the loghttp.TailResponse is created outside of
the loop, resulting in stale labels within the TailResponse LabelSet as
the unmarshal does not clear the map.

Fixes #8617

Signed-off-by: Cyrill Troxler <[email protected]>
  • Loading branch information
ctrox committed Oct 18, 2024
1 parent 71d1c6b commit 6af2829
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/logcli/query/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func (q *Query) TailQuery(delayFor time.Duration, c client.Client, out output.Lo
log.Println("Print only labels key:", color.RedString(strings.Join(q.ShowLabelsKey, ",")))
}

tailResponse := new(loghttp.TailResponse)
lastReceivedTimestamp := q.Start

for {
tailResponse := new(loghttp.TailResponse)
err := unmarshal.ReadTailResponseJSON(tailResponse, conn)
if err != nil {
// Check if the websocket connection closed unexpectedly. If so, retry.
Expand Down

0 comments on commit 6af2829

Please sign in to comment.