Skip to content

Commit

Permalink
Log Ingester.LabelNames() matchers in traces (#9544)
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci authored Oct 8, 2024
1 parent 25dadff commit ec15d48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,9 @@ func (i *Ingester) LabelNames(ctx context.Context, req *client.LabelNamesRequest
}
defer func() { finishReadRequest(err) }()

spanlog, ctx := spanlogger.NewWithLogger(ctx, i.logger, "Ingester.LabelNames")
defer spanlog.Finish()

userID, err := tenant.TenantID(ctx)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1768,6 +1771,9 @@ func (i *Ingester) LabelNames(ctx context.Context, req *client.LabelNamesRequest
}
defer q.Close()

// Log the actual matchers passed down to TSDB. This can be useful for troubleshooting purposes.
spanlog.DebugLog("num_matchers", len(matchers), "matchers", util.LabelMatchersToString(matchers))

hints := &storage.LabelHints{}
names, _, err := q.LabelNames(ctx, hints, matchers...)
if err != nil {
Expand Down

0 comments on commit ec15d48

Please sign in to comment.