Skip to content

Commit

Permalink
trcstore: search query match on CompactFileLine (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbourgon committed Jun 16, 2023
1 parent 96da685 commit 9ada6f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions trcstore/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ func (c *Collector) Search(ctx context.Context, req *SearchRequest) (*SearchResp
for category, rb := range c.categories.GetAll() {
// TODO: could do these concurrently
var categorySelected []*SearchTrace
rb.Walk(func(tr trc.Trace) error {
rb.Walk(func(candidate trc.Trace) error {
// Every trace should update the total, and be observed by stats.
total++
stats.Observe(tr)
stats.Observe(candidate)

// If we already have the max number of traces from this category,
// then we won't select any more. We do this first, because it's
Expand All @@ -140,12 +140,12 @@ func (c *Collector) Search(ctx context.Context, req *SearchRequest) (*SearchResp
}

// If the request won't allow this trace, then we won't select it.
if !req.Allow(ctx, tr) {
if !req.Allow(ctx, candidate) {
return nil
}

// Otherwise, collect a static copy of the trace.
categorySelected = append(categorySelected, NewSearchTrace(tr))
categorySelected = append(categorySelected, NewSearchTrace(candidate))
return nil
})
tr.LazyTracef("processed category=%s categorySelected=%d", category, len(categorySelected))
Expand Down
2 changes: 1 addition & 1 deletion trcstore/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (req *SearchRequest) Allow(ctx context.Context, tr trc.Trace) bool {
if req.regexp.MatchString(c.Function) {
return true
}
if req.regexp.MatchString(c.FileLine) {
if req.regexp.MatchString(c.CompactFileLine()) {
return true
}
}
Expand Down

0 comments on commit 9ada6f5

Please sign in to comment.