Documentation
¶
Overview ¶
Package profilestorage defines the storage structure and query interface for the profiles signal.
The actual storage backend (ClickHouse, object storage, etc.) is implemented elsewhere (e.g. oteldb/storage); this package only defines the domain types and the Querier interface consumed by the ProfileQL engine and the Pyroscope-compatible API handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// Name is the application name, typically "<service>.<profile-type>".
Name string
// SpyName is the profiler ("spy") that produced the profile, if known.
SpyName string
// SampleRate is the sampling rate in Hz, if known.
SampleRate uint32
// Units is the unit of the profile's sample values.
Units Units
}
App is the metadata of a profiled application, as returned by the Pyroscope `/api/apps` endpoint.
type FlameNode ¶
type FlameNode struct {
// Name is the resolved function name of the node.
Name string
// Self is the value of samples attributed directly to this node.
Self int64
// Total is the value of samples attributed to this node and its children.
Total int64
// Children are the child nodes, ordered left to right.
Children []*FlameNode
}
FlameNode is a single node of a FlameTree.
type FlameTree ¶
type FlameTree struct {
// Root is the root node of the tree. It may be nil for an empty result.
Root *FlameNode
}
FlameTree is a merged, symbol-resolved flamegraph tree.
It is the storage-agnostic representation produced by Querier.SelectMergeProfile and consumed by the ProfileQL engine, which converts it into the API-specific flamebearer format.
type LabelNamesOptions ¶
type LabelNamesOptions struct {
// Type, when set, restricts the lookup to series of the given profile type.
Type *profileql.ProfileType
// Matchers restricts the lookup to series matching the given matchers.
Matchers []profileql.LabelMatcher
// Start defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
Start time.Time
// End defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
End time.Time
}
LabelNamesOptions defines options for Querier.LabelNames.
type LabelValuesOptions ¶
type LabelValuesOptions struct {
// Type, when set, restricts the lookup to series of the given profile type.
Type *profileql.ProfileType
// Matchers restricts the lookup to series matching the given matchers.
Matchers []profileql.LabelMatcher
// Start defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
Start time.Time
// End defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
End time.Time
}
LabelValuesOptions defines options for Querier.LabelValues.
type ProfileTypesOptions ¶
type ProfileTypesOptions struct {
// Start defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
Start time.Time
// End defines the time range for the lookup.
//
// Querier ignores the parameter, if it is zero.
End time.Time
}
ProfileTypesOptions defines options for Querier.ProfileTypes.
type Querier ¶
type Querier interface {
// ProfileTypes returns the profile types available in the given time range.
ProfileTypes(ctx context.Context, opts ProfileTypesOptions) ([]profileql.ProfileType, error)
// LabelNames returns all label names matching the given selector.
LabelNames(ctx context.Context, opts LabelNamesOptions) ([]string, error)
// LabelValues returns all values for the given label matching the selector.
LabelValues(ctx context.Context, label string, opts LabelValuesOptions) ([]string, error)
// SelectMergeProfile merges all matching profiles into a single flamegraph
// tree, resolved to function names.
SelectMergeProfile(ctx context.Context, params SelectProfileParams) (*FlameTree, error)
}
Querier is a profile storage query interface.
Implementations are responsible for matching series by the profile-type and label matchers, resolving symbols, and merging samples into the requested representation.
type SelectProfileParams ¶
type SelectProfileParams struct {
// Type is the profile type to select.
Type profileql.ProfileType
// Matchers restricts the selection to series matching the given matchers.
Matchers []profileql.LabelMatcher
// Start defines the time range for the selection.
Start time.Time
// End defines the time range for the selection.
End time.Time
// MaxNodes, when positive, limits the number of nodes in the resulting
// flamegraph; smaller nodes are folded into an "other" node.
MaxNodes int
}
SelectProfileParams defines parameters for Querier.SelectMergeProfile.
type Units ¶
type Units string
Units describes the unit of a profile's sample values.
const ( UnitsSamples Units = "samples" UnitsObjects Units = "objects" UnitsGoroutines Units = "goroutines" UnitsBytes Units = "bytes" UnitsLockNanoseconds Units = "lock_nanoseconds" UnitsLockSamples Units = "lock_samples" )
Known profile sample units, matching the Pyroscope set.
func UnitsForProfileType ¶
func UnitsForProfileType(t profileql.ProfileType) Units
UnitsForProfileType returns the conventional Units for a profile type, following Pyroscope's mapping from sample type to unit.