Documentation ¶
Index ¶
- Constants
- func CloneLabelPairs(lbs []*typesv1.LabelPair) []*typesv1.LabelPair
- func CompareLabelPairs(a []*typesv1.LabelPair, b []*typesv1.LabelPair) int
- func CompareProfile(a, b *ingestv1.Profile) int64
- func ExportDiffToFlamebearer(fg *querierv1.FlameGraphDiff, profileType *typesv1.ProfileType) *flamebearer.FlamebearerProfile
- func ExportToFlamebearer(fg *querierv1.FlameGraph, profileType *typesv1.ProfileType) *flamebearer.FlamebearerProfile
- func GetTimeRange(req TimeRangeRequest) (model.Interval, bool)
- func IsLabelAllowedForIngestion(name string) bool
- func LabelPairsString(lbs []*typesv1.LabelPair) string
- func MergeSeries(aggregation *typesv1.TimeSeriesAggregationType, series ...[]*typesv1.Series) []*typesv1.Series
- func NewFlameGraph(t *Tree, maxNodes int64) *querierv1.FlameGraph
- func NewFlamegraphDiff(left, right *Tree, maxNodes int64) (*querierv1.FlameGraphDiff, error)
- func ParseProfileTypeSelector(id string) (*typesv1.ProfileType, error)
- func SelectorFromProfileType(profileType *typesv1.ProfileType) *labels.Matcher
- func StableHash(ls labels.Labels) uint64
- func StacktracePartitionFromProfile(lbls []Labels, p *profilev1.Profile) uint64
- func StringToLabelsPairs(s string) ([]*typesv1.LabelPair, error)
- type FlameGraphMerger
- type Labels
- func (ls Labels) BytesWithLabels(buf []byte, names ...string) []byte
- func (ls Labels) Clone() Labels
- func (ls Labels) Delete(name string) Labels
- func (ls Labels) Get(name string) string
- func (ls Labels) GetLabel(name string) (*typesv1.LabelPair, bool)
- func (ls Labels) Hash() uint64
- func (ls Labels) HashForLabels(b []byte, names ...string) (uint64, []byte)
- func (ls Labels) Len() int
- func (ls Labels) Less(i, j int) bool
- func (ls Labels) Swap(i, j int)
- func (ls Labels) ToPrometheusLabels() labels.Labels
- func (ls Labels) Unique() Labels
- func (ls Labels) WithLabels(names ...string) Labels
- func (ls Labels) WithoutPrivateLabels() Labels
- type LabelsBuilder
- type SeriesMerger
- type ServiceVersion
- type SessionID
- type SpanSelector
- type Stack
- type StacktraceMerger
- type StacktraceNode
- type StacktraceTree
- func (t *StacktraceTree) Bytes(dst io.Writer, maxNodes int64, funcs []string)
- func (t *StacktraceTree) Insert(locations []int32, value int64) int32
- func (t *StacktraceTree) LookupLocations(dst []uint64, idx int32) []uint64
- func (t *StacktraceTree) MinValue(maxNodes int64) int64
- func (t *StacktraceTree) Traverse(maxNodes int64, fn StacktraceTreeTraverseFn) error
- type StacktraceTreeTraverseFn
- type TimeRangeRequest
- type Tree
- func (t *Tree) Fix()
- func (t *Tree) FormatNodeNames(fn func(string) string)
- func (t *Tree) InsertStack(v int64, stack ...string)
- func (t *Tree) IterateStacks(cb func(name string, self int64, stack []string))
- func (t *Tree) MarshalTruncate(w io.Writer, maxNodes int64) (err error)
- func (t *Tree) Merge(src *Tree)
- func (t *Tree) String() string
- func (t *Tree) Total() (v int64)
- func (t *Tree) WriteCollapsed(dst io.Writer)
- type TreeMerger
Constants ¶
const ( LabelNameProfileType = "__profile_type__" LabelNameType = "__type__" LabelNameUnit = "__unit__" LabelNamePeriodType = "__period_type__" LabelNamePeriodUnit = "__period_unit__" LabelNameDelta = "__delta__" LabelNameProfileName = pmodel.MetricNameLabel LabelNameSessionID = "__session_id__" LabelNameServiceName = "service_name" LabelNameServiceRepository = "service_repository" LabelNameServiceGitRef = "service_git_ref" LabelNamePyroscopeSpy = "pyroscope_spy" LabelNameServiceNameK8s = "__meta_kubernetes_pod_annotation_pyroscope_io_service_name" )
Variables ¶
This section is empty.
Functions ¶
func CloneLabelPairs ¶
CloneLabelPairs clones the label pairs.
func CompareLabelPairs ¶
Compare compares the two label sets. The result will be 0 if a==b, <0 if a < b, and >0 if a > b.
func CompareProfile ¶
CompareProfile compares the two profiles.
func ExportDiffToFlamebearer ¶
func ExportDiffToFlamebearer(fg *querierv1.FlameGraphDiff, profileType *typesv1.ProfileType) *flamebearer.FlamebearerProfile
func ExportToFlamebearer ¶
func ExportToFlamebearer(fg *querierv1.FlameGraph, profileType *typesv1.ProfileType) *flamebearer.FlamebearerProfile
ExportToFlamebearer exports the flamegraph to a Flamebearer struct.
func GetTimeRange ¶ added in v1.2.0
func GetTimeRange(req TimeRangeRequest) (model.Interval, bool)
GetTimeRange returns the time interval and true if the request has an interval, otherwise ok is false.
func IsLabelAllowedForIngestion ¶ added in v1.1.0
func LabelPairsString ¶
LabelPairsString returns a string representation of the label pairs.
func MergeSeries ¶ added in v1.2.1
func NewFlameGraph ¶
func NewFlameGraph(t *Tree, maxNodes int64) *querierv1.FlameGraph
func NewFlamegraphDiff ¶
func NewFlamegraphDiff(left, right *Tree, maxNodes int64) (*querierv1.FlameGraphDiff, error)
NewFlamegraphDiff generates a FlameGraphDiff from 2 trees. It also prunes the final tree based on the maxNodes parameter Notice that the resulting FlameGraph can't be used interchangeably with a 'single' Flamegraph Due to many differences: * Nodes * It's structure is different
i+0 = x offset, left tree i+1 = total , left tree i+2 = self , left tree i+3 = x offset, right tree i+4 = total , right tree i+5 = self , right tree i+6 = index in the names array
func ParseProfileTypeSelector ¶
func ParseProfileTypeSelector(id string) (*typesv1.ProfileType, error)
ParseProfileTypeSelector parses the profile selector string.
func SelectorFromProfileType ¶
func SelectorFromProfileType(profileType *typesv1.ProfileType) *labels.Matcher
SelectorFromProfileType builds a *label.Matcher from an profile type struct
func StableHash ¶ added in v1.1.0
StableHash is a labels hashing implementation which is guaranteed to not change over time. This function should be used whenever labels hashing backward compatibility must be guaranteed.
Types ¶
type FlameGraphMerger ¶
type FlameGraphMerger struct {
// contains filtered or unexported fields
}
func NewFlameGraphMerger ¶
func NewFlameGraphMerger() *FlameGraphMerger
func (*FlameGraphMerger) FlameGraph ¶
func (m *FlameGraphMerger) FlameGraph(maxNodes int64) *querierv1.FlameGraph
func (*FlameGraphMerger) MergeFlameGraph ¶
func (m *FlameGraphMerger) MergeFlameGraph(src *querierv1.FlameGraph)
MergeFlameGraph adds the flame graph stack traces to the resulting flame graph. The call is thread-safe, but the resulting flame graph or tree should be only accessed after all the samples are merged.
func (*FlameGraphMerger) Tree ¶
func (m *FlameGraphMerger) Tree() *Tree
type Labels ¶
Labels is a sorted set of labels. Order has to be guaranteed upon instantiation.
func LabelsFromStrings ¶
LabelsFromStrings creates new labels from pairs of strings.
func (Labels) BytesWithLabels ¶
BytesWithLabels is just as Bytes(), but only for labels matching names. 'names' have to be sorted in ascending order. It uses an byte invalid character as a separator and so should not be used for printing.
func (Labels) Delete ¶ added in v1.1.0
Delete removes the first label encountered with the name given. A copy of the label set without the label is returned.
func (Labels) Get ¶
Get returns the value for the label with the given name. Returns an empty string if the label doesn't exist.
func (Labels) HashForLabels ¶
HashForLabels returns a hash value for the labels matching the provided names. 'names' have to be sorted in ascending order.
func (Labels) ToPrometheusLabels ¶
func (Labels) Unique ¶ added in v1.1.0
Unique returns a set labels with unique keys. Labels expected to be sorted: underlying capacity is reused and the original order is preserved: the first key takes precedence over duplicates. Method receiver should not be used after the call.
func (Labels) WithLabels ¶
WithLabels returns a subset of Labels that matches match with the provided label names.
func (Labels) WithoutPrivateLabels ¶
type LabelsBuilder ¶
type LabelsBuilder struct {
// contains filtered or unexported fields
}
LabelsBuilder allows modifying Labels.
func NewLabelsBuilder ¶
func NewLabelsBuilder(base Labels) *LabelsBuilder
NewLabelsBuilder returns a new LabelsBuilder.
func (*LabelsBuilder) Del ¶
func (b *LabelsBuilder) Del(ns ...string) *LabelsBuilder
Del deletes the label of the given name.
func (*LabelsBuilder) Labels ¶
func (b *LabelsBuilder) Labels() Labels
Labels returns the labels from the builder. If no modifications were made, the original labels are returned.
func (*LabelsBuilder) Reset ¶
func (b *LabelsBuilder) Reset(base Labels)
Reset clears all current state for the builder.
func (*LabelsBuilder) Set ¶
func (b *LabelsBuilder) Set(n, v string) *LabelsBuilder
Set the name/value pair as a label.
type SeriesMerger ¶
type SeriesMerger struct {
// contains filtered or unexported fields
}
func NewSeriesMerger ¶
func NewSeriesMerger(sum bool) *SeriesMerger
NewSeriesMerger creates a new series merger. If sum is set, samples with matching timestamps are summed, otherwise duplicates are retained.
func (*SeriesMerger) MergeSeries ¶
func (m *SeriesMerger) MergeSeries(s []*typesv1.Series)
func (*SeriesMerger) Series ¶
func (m *SeriesMerger) Series() []*typesv1.Series
type ServiceVersion ¶ added in v1.3.0
type ServiceVersion struct { Repository string `json:"repository,omitempty"` GitRef string `json:"git_ref,omitempty"` BuildID string `json:"build_id,omitempty"` }
func ServiceVersionFromLabels ¶ added in v1.3.0
func ServiceVersionFromLabels(lbls Labels) (ServiceVersion, bool)
ServiceVersionFromLabels Attempts to extract a service version from the given labels. Returns false if no service version was found.
type SpanSelector ¶ added in v1.2.0
type SpanSelector map[uint64]struct{}
func NewSpanSelector ¶ added in v1.2.0
func NewSpanSelector(spans []string) (SpanSelector, error)
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
Stack is a stack of values. Pushing and popping values is O(1).
type StacktraceMerger ¶
type StacktraceMerger struct {
// contains filtered or unexported fields
}
func NewStackTraceMerger ¶
func NewStackTraceMerger() *StacktraceMerger
NewStackTraceMerger merges collections of StacktraceSamples. The result is a byte tree representation of the merged samples.
func (*StacktraceMerger) MergeStackTraces ¶
func (m *StacktraceMerger) MergeStackTraces(stacks []*ingestv1.StacktraceSample, names []string)
MergeStackTraces adds the stack traces to the resulting tree. The call is thread-safe, but the resulting tree bytes should be only build after all the samples are merged. Note that the function may reuse the capacity of the names slice.
func (*StacktraceMerger) Size ¶
func (m *StacktraceMerger) Size() int
func (*StacktraceMerger) TreeBytes ¶
func (m *StacktraceMerger) TreeBytes(maxNodes int64) []byte
type StacktraceNode ¶
type StacktraceTree ¶
type StacktraceTree struct{ Nodes []StacktraceNode }
func NewStacktraceTree ¶
func NewStacktraceTree(size int) *StacktraceTree
func (*StacktraceTree) Bytes ¶
func (t *StacktraceTree) Bytes(dst io.Writer, maxNodes int64, funcs []string)
func (*StacktraceTree) Insert ¶
func (t *StacktraceTree) Insert(locations []int32, value int64) int32
func (*StacktraceTree) LookupLocations ¶ added in v1.2.1
func (t *StacktraceTree) LookupLocations(dst []uint64, idx int32) []uint64
func (*StacktraceTree) MinValue ¶
func (t *StacktraceTree) MinValue(maxNodes int64) int64
MinValue returns the minimum "total" value a node in a tree has to have.
func (*StacktraceTree) Traverse ¶
func (t *StacktraceTree) Traverse(maxNodes int64, fn StacktraceTreeTraverseFn) error
type TimeRangeRequest ¶ added in v1.2.0
TimeRangeRequest is a request that has a time interval.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func UnmarshalTree ¶
func (*Tree) Fix ¶ added in v1.1.0
func (t *Tree) Fix()
Fix re-establishes order of nodes and merges duplicates.
func (*Tree) FormatNodeNames ¶ added in v1.1.0
func (*Tree) InsertStack ¶
func (*Tree) IterateStacks ¶
func (*Tree) MarshalTruncate ¶
MarshalTruncate writes tree byte representation to the writer provider, the number of nodes is limited to maxNodes. The function modifies the tree: truncated nodes are removed from the tree.
func (*Tree) WriteCollapsed ¶
type TreeMerger ¶
type TreeMerger struct {
// contains filtered or unexported fields
}
func NewTreeMerger ¶
func NewTreeMerger() *TreeMerger
func (*TreeMerger) MergeTreeBytes ¶
func (m *TreeMerger) MergeTreeBytes(b []byte) error
func (*TreeMerger) Tree ¶
func (m *TreeMerger) Tree() *Tree