(ctx context.Context, req FetchTagValuesRequest, cb FetchTagValuesCallback)
| 364 | } |
| 365 | |
| 366 | func (m *MockAutocompleteFetcher) Fetch(ctx context.Context, req FetchTagValuesRequest, cb FetchTagValuesCallback) error { |
| 367 | rootExpr, err := Parse(m.query) |
| 368 | if err != nil { |
| 369 | return err |
| 370 | } |
| 371 | if err := rootExpr.validate(); err != nil { |
| 372 | return err |
| 373 | } |
| 374 | |
| 375 | for { |
| 376 | spanset, err := m.iterator.Next(ctx) |
| 377 | if err != nil && errors.Is(err, io.EOF) { |
| 378 | return err |
| 379 | } |
| 380 | if spanset == nil { |
| 381 | break |
| 382 | } |
| 383 | if len(spanset.Spans) == 0 { |
| 384 | continue |
| 385 | } |
| 386 | |
| 387 | evalSS, _ := rootExpr.Pipeline.evaluate([]*Spanset{spanset}) |
| 388 | |
| 389 | for _, ss := range evalSS { |
| 390 | for _, s := range ss.Spans { |
| 391 | for attr, static := range s.AllAttributes() { |
| 392 | if attr.Name != req.TagName.Name { |
| 393 | continue |
| 394 | } |
| 395 | if cb(static) { |
| 396 | return nil |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | return nil |
| 404 | } |
| 405 | |
| 406 | type MockSpanSetFetcher struct { |
| 407 | iterator SpansetIterator |
nothing calls this directly
no test coverage detected