Query Profiling Flamegraphs
Retrieve profiling flamegraphs and compare profiles across time ranges or filters.
Endpoints
GET
/api/profiling/v1/flamegraphGET
/api/profiling/v1/flamegraph-diff
Authentication
Send Authorization: Bearer <YOUR_API_KEY> and X-Backend-Id: <YOUR_BACKEND_ID>. JSON requests also require Content-Type: application/json. The examples use https://api.groundcover.com; use your deployment's API URL for a self-hosted installation. Replace the example time range with one containing your data.
Query Parameters
start, end
Yes
start and end are RFC3339 timestamps; start must be earlier than end.
query
Yes
gcQL filters selecting one workload, one stored profile_type, and one sample_type as top-level AND conditions.
limit
No
Maximum detailed stacks, default 50000, maximum 50000.
focus
No
JSON array of exact root-to-leaf frame names, such as ["main","worker"].
frameFilter
No
Case-sensitive substring that must occur in a retained stack.
invert
No
true returns sampled functions first, followed by callers.
Use the exact stored profile and sample identifiers. Shorthand aliases are not expanded. Discover them with field/value discovery using type: "profiling_samples".
Retrieve a Flamegraph
curl --get 'https://api.groundcover.com/api/profiling/v1/flamegraph' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'X-Backend-Id: <YOUR_BACKEND_ID>' \
--data-urlencode 'start=2026-10-28T10:00:00Z' \
--data-urlencode 'end=2026-10-28T11:00:00Z' \
--data-urlencode 'query=workload:checkout-service AND profile_type:"pprof:cpu_samples:count" AND sample_type:samples' \
--data-urlencode 'limit=1000'Response
The JSON response contains:
root: tree nodes withname, inclusivevalue, direct sampled weightself, and optionalchildren.profileType,sampleType,unit, andperiod: the measurement and selected range.total: weight of the original authorized selection.filteredValue: signed weight removed by focus/frame filtering.root.valueequalstotal - filteredValue.truncated: whether tree detail was collapsed.stacks.totalandstacks.returned: matching aggregate stacks and stacks selected for detailed paths.
Synthetic remainder nodes have omitted: true; distinguish these from a real function named other. In a normal tree, value = self + sum(children.value). In an inverted tree, callers partition the same sampled weight, so that identity does not apply.
Window measurements sum samples. Snapshot measurements such as in-use memory average snapshots per pod before summing pods. An empty selection returns a zero-weight root.
Compare Two Windows
Use /flamegraph-diff with the same parameters, adding baseStart and baseEnd together. Optional baseQuery defaults to query. Both selections must pin the same workload, profile_type, and sample_type.
Diff nodes add baseValue and baseSelf; the response adds baseTotal, baseFilteredValue, and basePeriod. Values are raw weights per side, so normalize by duration in your client when comparing windows of different lengths. A frame absent from one side has zero weight on that side. Diff ranges are half-open [start,end); the single flamegraph endpoint includes its end timestamp.
If baseStart/baseEnd are omitted, the baseline uses the current time range; set baseQuery to compare filters within one window. Focus, frame filtering, and inversion apply to both sides.
Errors
400: invalid filters, missing pins, mismatched comparison measurements, or invalid parameters.
404: profiling reads unavailable in the backend.
422: read limits exceeded or unsupported negative values in a comparison. Narrow the range or filters.
504: query deadline exceeded.
A truncated response still accounts for omitted weight with remainder nodes. A read-limit error is not a successful partial result.
Last updated
