query

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlamegraphFieldLabelsOnly = "labels_only"

	FlamegraphFieldMappingFile    = "mapping_file"
	FlamegraphFieldMappingBuildID = "mapping_build_id"

	FlamegraphFieldLocationAddress = "location_address"
	FlamegraphFieldLocationLine    = "location_line"

	FlamegraphFieldInlined            = "inlined"
	FlamegraphFieldFunctionStartLine  = "function_startline"
	FlamegraphFieldFunctionName       = "function_name"
	FlamegraphFieldFunctionSystemName = "function_system_name"
	FlamegraphFieldFunctionFileName   = "function_file_name"

	FlamegraphFieldLabels     = "labels"
	FlamegraphFieldChildren   = "children"
	FlamegraphFieldCumulative = "cumulative"
	FlamegraphFieldFlat       = "flat"
	FlamegraphFieldDiff       = "diff"
)
View Source
const (
	TableFieldMappingFile    = "mapping_file"
	TableFieldMappingBuildID = "mapping_build_id"

	TableFieldLocationAddress = "location_address"
	TableFieldLocationLine    = "location_line"

	TableFieldFunctionStartLine  = "function_startline"
	TableFieldFunctionName       = "function_name"
	TableFieldFunctionSystemName = "function_system_name"
	TableFieldFunctionFileName   = "function_file_name"

	TableFieldCumulative     = "cumulative"
	TableFieldCumulativeDiff = "cumulative_diff"
	TableFieldFlat           = "flat"
	TableFieldFlatDiff       = "flat_diff"

	TableFieldCallers = "callers"
	TableFieldCallees = "callees"
)
View Source
const (
	NodeCutOffFraction = float32(0.005)
)

Variables

View Source
var (
	ErrSourceNotFound     = errors.New("Source file not found. Either profiling metadata is wrong, or the referenced file was not included in the uploaded sources.")
	ErrNoSourceForBuildID = errors.New("No sources for this build id have been uploaded.")
)

Functions

func ComputeDiff added in v0.21.0

func ComputeDiff(ctx context.Context, tracer trace.Tracer, mem memory.Allocator, base, compare profile.Profile, absolute bool) (profile.Profile, error)

func FilterProfileData added in v0.17.0

func FilterProfileData(
	ctx context.Context,
	tracer trace.Tracer,
	pool memory.Allocator,
	records []arrow.Record,
	functionStackFilter string,
	binaryFrameFilter map[string]struct{},
) ([]arrow.Record, int64, error)

func GenerateCallgraph added in v0.13.0

func GenerateCallgraph(ctx context.Context, p profile.OldProfile) (*querypb.Callgraph, error)

func GenerateFlamegraphArrow added in v0.19.0

func GenerateFlamegraphArrow(
	ctx context.Context,
	mem memory.Allocator,
	tracer trace.Tracer,
	p profile.Profile,
	aggregate []string,
	trimFraction float32,
) (*queryv1alpha1.FlamegraphArrow, int64, error)

func GenerateFlamegraphFlat added in v0.7.0

func GenerateFlamegraphFlat(ctx context.Context, tracer trace.Tracer, p profile.OldProfile) (*pb.Flamegraph, error)

func GenerateFlamegraphTable added in v0.14.0

func GenerateFlamegraphTable(ctx context.Context, tracer trace.Tracer, p profile.OldProfile, nodeTrimFraction float32, pool *sync.Pool) (*querypb.Flamegraph, error)

func GenerateFlatPprof added in v0.7.0

func GenerateFlatPprof(
	ctx context.Context,
	isDiff bool,
	p parcaprofile.Profile,
) (*pprofpb.Profile, error)

func GenerateSourceReport added in v0.19.0

func GenerateSourceReport(
	ctx context.Context,
	pool memory.Allocator,
	tracer trace.Tracer,
	p profile.Profile,
	ref *pb.SourceReference,
	source string,
) (*pb.Source, int64, error)

func GenerateTable added in v0.19.0

func GenerateTable(
	ctx context.Context,
	mem memory.Allocator,
	tracer trace.Tracer,
	p profile.Profile,
) (*queryv1alpha1.TableArrow, int64, error)

func GenerateTopTable added in v0.8.0

func GenerateTopTable(ctx context.Context, p parcaprofile.OldProfile) (*pb.Top, int64, error)

func Gzip added in v0.19.0

func Gzip(data []byte) ([]byte, error)

func MergeTwoSortedSlices added in v0.22.0

func MergeTwoSortedSlices(arr1, arr2 []string) []string

This is a deduplicating k-way merge. The two slices that are passed in are assumed to be sorted.

func NewTableConverterPool added in v0.18.0

func NewTableConverterPool() *sync.Pool

func RenderReport added in v0.17.0

func RenderReport(
	ctx context.Context,
	tracer trace.Tracer,
	p profile.Profile,
	typ pb.QueryRequest_ReportType,
	nodeTrimThreshold float32,
	filtered int64,
	groupBy []string,
	pool *sync.Pool,
	mem memory.Allocator,
	converter *parcacol.ArrowToProfileConverter,
	sourceReference *pb.SourceReference,
	source string,
	isDiff bool,
) (*pb.QueryResponse, error)

func SerializePprof added in v0.19.0

func SerializePprof(p *pprofpb.Profile) ([]byte, error)

func TrimFlamegraph added in v0.16.0

func TrimFlamegraph(ctx context.Context, tracer trace.Tracer, graph *querypb.Flamegraph, threshold float32) *querypb.Flamegraph

Types

type BucketSourceFinder added in v0.19.0

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

func NewBucketSourceFinder added in v0.19.0

func NewBucketSourceFinder(
	bucket objstore.BucketReader,
	debuginfod DebuginfodClients,
) *BucketSourceFinder

func (*BucketSourceFinder) FindSource added in v0.19.0

func (f *BucketSourceFinder) FindSource(ctx context.Context, ref *pb.SourceReference) (string, error)

func (*BucketSourceFinder) SourceExists added in v0.19.0

func (f *BucketSourceFinder) SourceExists(ctx context.Context, ref *pb.SourceReference) (bool, error)

type ColumnQueryAPI added in v0.11.0

type ColumnQueryAPI struct {
	pb.UnimplementedQueryServiceServer
	// contains filtered or unexported fields
}

ColumnQueryAPI is the read api interface for parca It implements the proto/query/query.proto APIServer interface.

func NewColumnQueryAPI added in v0.11.0

func NewColumnQueryAPI(
	logger log.Logger,
	tracer trace.Tracer,
	shareClient sharepb.ShareServiceClient,
	querier Querier,
	mem memory.Allocator,
	converter *parcacol.ArrowToProfileConverter,
	sourceFinder SourceFinder,
) *ColumnQueryAPI

func (*ColumnQueryAPI) Labels added in v0.11.0

Labels issues a labels request against the storage.

func (*ColumnQueryAPI) ProfileTypes added in v0.11.0

Types returns the available types of profiles.

func (*ColumnQueryAPI) Query added in v0.11.0

Query issues an instant query against the storage.

func (*ColumnQueryAPI) QueryRange added in v0.11.0

QueryRange issues a range query against the storage.

func (*ColumnQueryAPI) ShareProfile added in v0.12.0

func (*ColumnQueryAPI) Values added in v0.11.0

Values issues a values request against the storage.

type DebuginfodClients added in v0.22.0

type DebuginfodClients interface {
	GetSource(ctx context.Context, server, buildid, file string) (io.ReadCloser, error)
	Exists(ctx context.Context, buildid string) ([]string, error)
}

type FlamegraphChildren added in v0.16.0

type FlamegraphChildren []*querypb.FlamegraphNode

func (FlamegraphChildren) Cumulative added in v0.16.0

func (n FlamegraphChildren) Cumulative() int64

func (FlamegraphChildren) Diff added in v0.16.0

func (n FlamegraphChildren) Diff() int64

type FlamegraphIterator added in v0.7.0

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

func NewFlamegraphIterator added in v0.7.0

func NewFlamegraphIterator(fgRoot *querypb.FlamegraphNode) *FlamegraphIterator

func (*FlamegraphIterator) At added in v0.7.0

func (*FlamegraphIterator) AtParent added in v0.17.0

func (fgi *FlamegraphIterator) AtParent() *querypb.FlamegraphNode

func (*FlamegraphIterator) HasMore added in v0.7.0

func (fgi *FlamegraphIterator) HasMore() bool

func (*FlamegraphIterator) NextChild added in v0.7.0

func (fgi *FlamegraphIterator) NextChild() bool

func (*FlamegraphIterator) StepInto added in v0.7.0

func (fgi *FlamegraphIterator) StepInto() bool

func (*FlamegraphIterator) StepUp added in v0.7.0

func (fgi *FlamegraphIterator) StepUp()

type IndexRange added in v0.21.0

type IndexRange struct {
	Start int64
	End   int64
}

type Locations added in v0.7.0

type Locations interface {
	GetLocationsByIDs(ctx context.Context, id ...[]byte) (map[string]*pb.Location, [][]byte, error)
}

type PprofWriter added in v0.19.0

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

func NewPprofWriter added in v0.19.0

func NewPprofWriter(
	meta parcaprofile.Meta,
	isDiff bool,
) *PprofWriter

func (*PprofWriter) WriteRecord added in v0.19.0

func (w *PprofWriter) WriteRecord(rec arrow.Record)

type Querier added in v0.13.0

type Querier interface {
	Labels(ctx context.Context, match []string, start, end time.Time, profileType string) ([]string, error)
	Values(ctx context.Context, labelName string, match []string, start, end time.Time, profileType string) ([]string, error)
	QueryRange(ctx context.Context, query string, startTime, endTime time.Time, step time.Duration, limit uint32, sumBy []string) ([]*pb.MetricsSeries, error)
	ProfileTypes(ctx context.Context) ([]*pb.ProfileType, error)
	QuerySingle(ctx context.Context, query string, time time.Time, invertCallStacks bool) (profile.Profile, error)
	QueryMerge(ctx context.Context, query string, start, end time.Time, aggregateByLabels, invertCallStacks bool) (profile.Profile, error)
	GetProfileMetadataMappings(ctx context.Context, query string, start, end time.Time) ([]string, error)
	GetProfileMetadataLabels(ctx context.Context, start, end time.Time) ([]string, error)
}

type Releasable added in v0.22.0

type Releasable interface {
	Release()
}

type SourceFinder added in v0.19.0

type SourceFinder interface {
	FindSource(ctx context.Context, ref *pb.SourceReference) (string, error)
	SourceExists(ctx context.Context, ref *pb.SourceReference) (bool, error)
}

type SourcesReader added in v0.19.0

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

func NewSourcesReader added in v0.19.0

func NewSourcesReader(r io.ReaderAt) (*SourcesReader, error)

func (*SourcesReader) Find added in v0.19.0

func (s *SourcesReader) Find(filename string) ([]byte, error)

type TableGetter added in v0.14.0

type TableGetter interface {
	Strings() []string
	GetLocation(index uint32) *metastorev1alpha1.Location
	GetFunction(index uint32) *metastorev1alpha1.Function
}

type TreeStack added in v0.7.0

type TreeStack []*TreeStackEntry

func (*TreeStack) IsEmpty added in v0.7.0

func (s *TreeStack) IsEmpty() bool

func (*TreeStack) Peek added in v0.7.0

func (s *TreeStack) Peek() *TreeStackEntry

func (*TreeStack) Pop added in v0.7.0

func (s *TreeStack) Pop() (*TreeStackEntry, bool)

func (*TreeStack) Push added in v0.7.0

func (s *TreeStack) Push(e *TreeStackEntry)

func (*TreeStack) Size added in v0.7.0

func (s *TreeStack) Size() int

type TreeStackEntry added in v0.7.0

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

Jump to

Keyboard shortcuts

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