trace

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Overview

Package trace implements a trace-based storage which consists of trace data. Traces are composed of spans and support querying by trace ID and various tags. TODO: Remove this once trace partitioning is implemented nolint:unused

Index

Constants

View Source
const PartTypeCore = "core"

PartTypeCore is the type of the core part.

Variables

View Source
var (

	// ErrTraceNotExist denotes a trace doesn't exist in the metadata repo.
	ErrTraceNotExist = errors.New("trace doesn't exist")
)
View Source
var (

	// ErrTraceNotFound is returned when a trace is not found.
	ErrTraceNotFound = errors.New("trace not found")
)

Functions

func CreatePartFileReaderFromPath added in v0.10.0

func CreatePartFileReaderFromPath(partPath string, lfs fs.FileSystem) ([]queue.FileInfo, func())

CreatePartFileReaderFromPath opens all files in a part directory and returns their FileInfo and a cleanup function.

func CreateTestPartForDump

func CreateTestPartForDump(tmpPath string, fileSystem fs.FileSystem) (string, func())

CreateTestPartForDump creates a test trace part for testing the dump tool. It returns the part path (directory) and cleanup function.

func ParsePartMetadata added in v0.10.0

func ParsePartMetadata(fileSystem fs.FileSystem, partPath string) (queue.StreamingPartData, error)

ParsePartMetadata parses the part metadata from the metadata.json file.

func VisitTracesInTimeRange added in v0.10.0

func VisitTracesInTimeRange(tsdbRootPath string, timeRange timestamp.TimeRange, visitor Visitor, intervalRule storage.IntervalRule) ([]string, error)

VisitTracesInTimeRange traverses trace parts within the specified time range and calls the visitor methods for parts and sidx directories. This function works directly with the filesystem without requiring a database instance. Returns a list of segment suffixes that were visited.

Types

type NodeSelector

type NodeSelector interface {
	Locate(group, name string, shardID, replicaID uint32) (string, error)
	fmt.Stringer
}

NodeSelector provides functionality to locate nodes for data distribution.

type Query

type Query interface {
	LoadGroup(name string) (schema.Group, bool)
	Trace(metadata *commonv1.Metadata) (Trace, error)
	GetRemovalSegmentsTimeRange(group string) *timestamp.TimeRange
}

Query allows retrieving traces.

type SchemaService

type SchemaService interface {
	Query
	Close()
}

SchemaService allows querying schema information.

type Service

type Service interface {
	run.PreRunner
	run.Config
	run.Service
	Query
	CollectDataInfo(context.Context, string) (*databasev1.DataInfo, error)
	CollectLiaisonInfo(context.Context, string) (*databasev1.LiaisonInfo, error)
}

Service allows inspecting the trace data.

func LiaisonService

func LiaisonService(_ context.Context) (Service, error)

LiaisonService returns a new liaison service (deprecated - use NewLiaison).

func NewLiaison

func NewLiaison(metadata metadata.Repo, pipeline queue.Server, omr observability.MetricsRegistry, pm protector.Memory,
	dataNodeSelector node.Selector, tire2Client queue.Client,
) (Service, error)

NewLiaison creates a new trace liaison service with the given dependencies.

func NewService

func NewService(metadata metadata.Repo, pipeline queue.Server, omr observability.MetricsRegistry, pm protector.Memory) (Service, error)

NewService returns a new service.

type Trace

type Trace interface {
	GetSchema() *databasev1.Trace
	GetIndexRules() []*databasev1.IndexRule
	Query(ctx context.Context, opts model.TraceQueryOptions) (model.TraceQueryResult, error)
}

Trace allows inspecting trace details.

type Visitor added in v0.10.0

type Visitor interface {
	// VisitSeries visits the series index directory for a segment.
	VisitSeries(segmentTR *timestamp.TimeRange, seriesIndexPath string, shardIDs []common.ShardID) error
	// VisitShard visits the shard directory for a segment.
	VisitShard(segmentTR *timestamp.TimeRange, shardID common.ShardID, segmentPath string) error
}

Visitor defines the interface for visiting trace components.

Jump to

Keyboard shortcuts

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