Documentation
¶
Overview ¶
Package profileqlengine implements the ProfileQL evaluation engine.
It parses ProfileQL queries, selects matching profiles from a profilestorage.Querier, and renders them into the Pyroscope-compatible flamebearer format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is a ProfileQL evaluation engine.
func NewEngine ¶
func NewEngine(querier profilestorage.Querier, opts Options) *Engine
NewEngine creates a new Engine.
func (*Engine) Eval ¶
func (e *Engine) Eval(ctx context.Context, query string, params EvalParams) (*pyroscopeapi.FlamebearerProfileV1, error)
Eval parses and evaluates the query, returning a flamebearer profile.
type EvalParams ¶
type EvalParams struct {
// Time range to select, optional.
Start time.Time
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
}
EvalParams sets evaluation parameters.
type Options ¶
type Options struct {
// TracerProvider provides the OpenTelemetry tracer for this engine.
TracerProvider trace.TracerProvider
}
Options sets Engine options.
type Result ¶
type Result struct {
// Tree is the merged, symbol-resolved flamegraph tree. It may be nil for an
// empty result.
Tree *profilestorage.FlameTree
// Type is the profile type that was selected.
Type profileql.ProfileType
// MaxNodes is the node limit requested for the query, if any.
MaxNodes int
}
Result is the outcome of a ProfileQL query: a merged flamegraph tree together with the profile type it was selected for. It can be rendered into the various Pyroscope output formats.
func (*Result) Collapsed ¶
Collapsed renders the result into the "collapsed" (folded stacks) format: one line per stack with a non-zero self value, as a semicolon-separated list of frames (root to leaf) followed by a space and the self value.
The synthetic "total" root is omitted from the stacks.
func (*Result) Flamebearer ¶
func (r *Result) Flamebearer() *pyroscopeapi.FlamebearerProfileV1
Flamebearer renders the result into the Pyroscope flamebearer JSON format.
func (*Result) HTML ¶
HTML renders the result into a standalone HTML flamegraph page with the flamebearer profile embedded as JSON.