search

package
v1.5.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const SecretExhaustiveSearchTag = "x-dbg-exhaustive"

Variables

This section is empty.

Functions

func CombineSearchResults

func CombineSearchResults(existing *tempopb.TraceSearchMetadata, incoming *tempopb.TraceSearchMetadata)

CombineResults overlays the incoming search result with the existing result. This is required for the following reason: a trace may be present in multiple blocks, or in partial segments in live traces. The results should reflect elements of all segments.

func GetSearchResultFromData

func GetSearchResultFromData(s *tempofb.SearchEntry) *tempopb.TraceSearchMetadata

func GetVirtualTagValues

func GetVirtualTagValues(tagName string) []string

func GetVirtualTags

func GetVirtualTags() []string

func NewBackendSearchBlock

func NewBackendSearchBlock(input *StreamingSearchBlock, rw backend.Writer, blockID uuid.UUID, tenantID string, enc backend.Encoding, pageSizeBytes int) error

NewBackendSearchBlock iterates through the given WAL search data and writes it to the persistent backend in a more efficient paged form. Multiple traces are written in the same page to make sure of the flatbuffer CreateSharedString feature which dedupes strings across the entire buffer.

func WriteSearchBlockMeta

func WriteSearchBlockMeta(ctx context.Context, w backend.Writer, blockID uuid.UUID, tenantID string, sm *BlockMeta) error

Types

type BackendSearchBlock

type BackendSearchBlock struct {
	// contains filtered or unexported fields
}

func OpenBackendSearchBlock

func OpenBackendSearchBlock(blockID uuid.UUID, tenantID string, r backend.Reader) *BackendSearchBlock

OpenBackendSearchBlock opens the search data for an existing block in the given backend.

func (*BackendSearchBlock) BlockID

func (s *BackendSearchBlock) BlockID() uuid.UUID

BlockID provides access to the private field id

func (*BackendSearchBlock) Search

func (s *BackendSearchBlock) Search(ctx context.Context, p Pipeline, sr *Results) error

Search iterates through the block looking for matches.

func (*BackendSearchBlock) TagValues added in v1.3.0

func (s *BackendSearchBlock) TagValues(ctx context.Context, tagName string, cb tagCallback) error

func (*BackendSearchBlock) Tags added in v1.3.0

func (s *BackendSearchBlock) Tags(ctx context.Context, cb tagCallback) error

type BlockMeta

type BlockMeta struct {
	Version       string           `json:"version"`
	Encoding      backend.Encoding `json:"encoding"` // Encoding/compression format
	IndexPageSize uint32           `json:"indexPageSize"`
	IndexRecords  uint32           `json:"indexRecords"`
}

func ReadSearchBlockMeta

func ReadSearchBlockMeta(ctx context.Context, r backend.Reader, blockID uuid.UUID, tenantID string) (*BlockMeta, error)

type DataCombiner

type DataCombiner struct{}

func (*DataCombiner) Combine

func (*DataCombiner) Combine(_ string, searchData ...[]byte) ([]byte, bool, error)

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

func NewSearchPipeline

func NewSearchPipeline(req *tempopb.SearchRequest) Pipeline

func (*Pipeline) Matches

func (p *Pipeline) Matches(e tempofb.Trace) bool

func (*Pipeline) MatchesBlock

func (p *Pipeline) MatchesBlock(block tempofb.Block) bool

func (*Pipeline) MatchesPage

func (p *Pipeline) MatchesPage(pg tempofb.Page) bool

type Results

type Results struct {
	// contains filtered or unexported fields
}

Results eases performing a highly parallel search by funneling all results into a single channel that is easy to consume, signaling workers to quit early as needed, and collecting metrics.

func NewResults

func NewResults() *Results

func (*Results) AddBlockInspected

func (sr *Results) AddBlockInspected()

func (*Results) AddBlockSkipped

func (sr *Results) AddBlockSkipped()

func (*Results) AddBytesInspected

func (sr *Results) AddBytesInspected(c uint64)

func (*Results) AddResult

func (sr *Results) AddResult(ctx context.Context, r *tempopb.TraceSearchMetadata) (quit bool)

AddResult sends a search result from a search task (goroutine) to the receiver of the the search results, i.e. the initiator of the search. This function blocks until there is buffer space in the results channel or if the task should stop searching because the receiver went away or the given context is done. In this case true is returned.

func (*Results) AddTraceInspected

func (sr *Results) AddTraceInspected(c uint32)

func (*Results) AllWorkersStarted

func (sr *Results) AllWorkersStarted()

AllWorkersStarted indicates that no more workers (senders) will be launched, and the results channel can be closed once the number of workers reaches zero. This function call occurs after all calls to StartWorker.

func (*Results) BlocksInspected

func (sr *Results) BlocksInspected() uint32

func (*Results) BlocksSkipped

func (sr *Results) BlocksSkipped() uint32

func (*Results) BytesInspected

func (sr *Results) BytesInspected() uint64

func (*Results) Close

func (sr *Results) Close()

Close signals to all workers to quit, when max results is received and no more work is needed. Called by the initiator of the search in a defer statement like:

sr := NewSearchResults()
defer sr.Close()

func (*Results) FinishWorker

func (sr *Results) FinishWorker()

FinishWorker indicates a sender (goroutine) is done searching and will not send any more search results. When the last sender is finished, the results channel is closed.

func (*Results) Quit

func (sr *Results) Quit() bool

Quit returns if search tasks should quit early. This can occur due to max results already found, or other errors such as timeout, etc.

func (*Results) Results

func (sr *Results) Results() <-chan *tempopb.TraceSearchMetadata

Results returns the results channel. Channel is closed when the search is complete. Can be iterated by range like:

for res := range sr.Results()

func (*Results) StartWorker

func (sr *Results) StartWorker()

StartWorker indicates another sender will be using the results channel. Must be followed with a call to FinishWorker which is usually deferred in a goroutine:

sr.StartWorker()
go func() {
   defer sr.FinishWorker()

func (*Results) TracesInspected

func (sr *Results) TracesInspected() uint32

type SearchableBlock

type SearchableBlock interface {
	Tags(ctx context.Context, cb tagCallback) error
	TagValues(ctx context.Context, tagName string, cb tagCallback) error
	Search(ctx context.Context, p Pipeline, sr *Results) error
}

type StreamingSearchBlock

type StreamingSearchBlock struct {
	// contains filtered or unexported fields
}

StreamingSearchBlock is search data that is read/write, i.e. for traces in the WAL.

func NewStreamingSearchBlockForFile

func NewStreamingSearchBlockForFile(f *os.File, blockID uuid.UUID, enc backend.Encoding) (*StreamingSearchBlock, error)

NewStreamingSearchBlockForFile creates a new streaming block that will read/write the given file. File must be opened for read/write permissions.

func RescanBlocks

func RescanBlocks(walPath string) ([]*StreamingSearchBlock, error)

RescanBlocks scans through the search directory in the WAL folder and replays files todo: copied from wal.RescanBlocks(), see if we can reduce duplication?

func (*StreamingSearchBlock) Append

func (s *StreamingSearchBlock) Append(ctx context.Context, id common.ID, searchData [][]byte) error

Append the given search data to the streaming block. Multiple byte buffers of search data for the same trace can be passed and are merged into one entry.

func (*StreamingSearchBlock) BlockID

func (s *StreamingSearchBlock) BlockID() uuid.UUID

BlockID provides access to the private field blockID

func (*StreamingSearchBlock) Clear

func (s *StreamingSearchBlock) Clear() error

Clear deletes the files for this block.

func (*StreamingSearchBlock) Close

func (s *StreamingSearchBlock) Close() error

Close closes the WAL file. Used in tests

func (*StreamingSearchBlock) Iterator

func (s *StreamingSearchBlock) Iterator() (common.Iterator, error)

func (*StreamingSearchBlock) Search

func (s *StreamingSearchBlock) Search(ctx context.Context, p Pipeline, sr *Results) error

Search the streaming block.

func (*StreamingSearchBlock) TagValues added in v1.3.0

func (s *StreamingSearchBlock) TagValues(_ context.Context, tagName string, cb tagCallback) error

func (*StreamingSearchBlock) Tags added in v1.3.0

func (s *StreamingSearchBlock) Tags(_ context.Context, cb tagCallback) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL