Skip to content

Commit

Permalink
fix(chstorage): return right tag name when querying span names
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed May 24, 2024
1 parent 3b439b1 commit 07ae77e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/chstorage/querier_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (q *Querier) TagValues(ctx context.Context, tag traceql.Attribute, opts tra
return iterators.Empty[tracestorage.Tag](), nil
case traceql.SpanName, traceql.RootSpanName:
// FIXME(tdakkota): we don't check if span name is actually coming from a root span.
return q.spanNames(ctx, opts)
return q.spanNames(ctx, tag, opts)
case traceql.RootServiceName:
// FIXME(tdakkota): we don't check if service.name actually coming from a root span.
//
Expand All @@ -203,7 +203,7 @@ func (q *Querier) TagValues(ctx context.Context, tag traceql.Attribute, opts tra
}
}

func (q *Querier) spanNames(ctx context.Context, opts tracestorage.TagValuesOptions) (_ iterators.Iterator[tracestorage.Tag], rerr error) {
func (q *Querier) spanNames(ctx context.Context, tag traceql.Attribute, opts tracestorage.TagValuesOptions) (_ iterators.Iterator[tracestorage.Tag], rerr error) {
table := q.tables.Spans

ctx, span := q.tracer.Start(ctx, "spanNames",
Expand All @@ -228,6 +228,8 @@ func (q *Querier) spanNames(ctx context.Context, opts tracestorage.TagValuesOpti
}

var (
tagName = tag.String()

name = new(proto.ColStr).LowCardinality()
r []tracestorage.Tag
)
Expand All @@ -240,7 +242,7 @@ func (q *Querier) spanNames(ctx context.Context, opts tracestorage.TagValuesOpti
OnResult: func(ctx context.Context, block proto.Block) error {
for i := 0; i < name.Rows(); i++ {
r = append(r, tracestorage.Tag{
Name: "name",
Name: tagName,
Value: name.Row(i),
Type: traceql.TypeString,
Scope: traceql.ScopeNone,
Expand Down

0 comments on commit 07ae77e

Please sign in to comment.