Performance Rca
Grafana LabsOfficialPublished by Grafana Labs
- Skill
- Research and analysis
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Performance RCA provides a structured methodology for diagnosing service performance issues such as high CPU, memory growth, lock contention, or unexpected hot functions. By leveraging Grafana Pyroscope profiles through the gcx CLI, the skill guides users through comparing incident windows against qualified baselines. It emphasizes evidence-based analysis, requiring users to validate findings through profile metrics, function rankings, and call-stack visualizations before drawing conclusions about root causes.
What it does
- Compares performance profiles between incident and baseline time windows.
- Identifies hot functions and changed application stacks using flame graphs and tables.
- Supports analysis of CPU, memory, contention, and goroutine/thread metrics.
- Provides a standardized reporting template for documenting investigation findings.
- Integrates with pprof for advanced differential analysis of profile data.
- Validates data availability and coverage before performing deep-dive analysis.
When to use it
- When a service exhibits high CPU, memory leaks, or GC pressure.
- After a deployment when code regression is suspected.
- When investigating performance anomalies reported by monitoring tools.
- When you need to compare current service behavior against a known stable baseline.
Advantages
- Enforces a rigorous, step-by-step investigation contract to ensure data validity.
- Reduces guesswork by requiring qualified controls and baseline comparisons.
- Provides clear exit paths when data is missing or instrumentation is unavailable.
- Facilitates precise attribution of performance costs to specific code paths.
Usage examples
- “Investigate why the 'auth-service' CPU usage spiked between 14:00 and 15:00 UTC today compared to yesterday.”
- The agent will query the Pyroscope datasource for the specified window, compare it against the baseline, and generate a report identifying the specific functions contributing to the CPU spike.
- “My service is showing high memory allocation. Can you help me find the cause?”
- The agent will guide you through selecting the appropriate memory lens, identifying the relevant workload slice, and analyzing the allocation stacks to pinpoint the source of the pressure.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/grafana/performance-rca/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip performance-rca.zip -d .agents/skills
Documentation by Grafana Labs
Performance RCA
Explain the observed performance problem: which workload changed, which code path accounts for it, and what evidence supports the mechanism. A hotspot is a location; an anomaly is a lead; neither alone proves a root cause. Stop at the strongest supported conclusion, including an inconclusive result. Code changes and proactive optimization are separate tasks.
Investigation contract
Follow Sections 1–5 in order. Reuse verified evidence from an earlier step or referring investigation; do not repeat discovery merely to satisfy the sequence. Establish each step's prerequisites before interpreting its result.
Fix the context, datasource, UTC windows, selectors, and profile type before comparison. Discover missing identifiers; never invent them. Record any justified change to the scope or comparison.
Qualify the control in Section 2 before claiming a regression. Without one, continue only to current cost attribution and label the comparison missing.
Distinguish empty results, unsupported capabilities, and query failures. Apply Section 1's exits to the affected profiling path; use its documented fallbacks only when their prerequisites hold.
Select output formats explicitly: JSON for discovery/metrics, table to rank functions, DOT to trace callers and callees, and pprof for export. Retain diagnostics and limits.
Always produce Section 5's report, including after an exit. Fill unsupported fields with
unknown,not measured, ornot applicable, plus a reason. A missing measurement must never become evidence that the service is healthy.
1. Preserve the question and check usable profiles
Reuse the context, datasource, service, symptom, incident window, deployment
facts, and trace/profile links supplied by the user or a referring skill. Pin
absolute UTC incident and baseline times. Derive a missing incident interval
from timestamped symptom evidence, or ask for it before querying. Carry the same
--context <context> on remote commands (omitted below), and pass the
datasource UID explicitly. Keep the investigation read-only; do not switch
contexts or change collection.
gcx help-tree profiles -o textThe examples below need gcx v1.3.0 or later; check with gcx --version. If
gcx is missing or older, ask the user to install or upgrade it from
https://github.com/grafana/gcx before continuing. Do not guess command renames
or silently drop time filters. Commands, flags, and output formats can still
be unsupported by the backend; Section 4 and the advanced reference describe
those fallbacks.
# Discover only if the datasource UID is unknown; choose the target environment.
gcx datasources list -t grafana-pyroscope-datasource -o json
gcx profiles data-range -d <pyro-uid> -o json
gcx profiles list-profile-types -d <pyro-uid> \
--from <incident-from> --to <incident-to> -o jsonCLI support does not imply backend support. data-range returns tenant-wide
dataIngested, oldestProfileTime, and newestProfileTime (Unix
milliseconds; zero means unknown). These bounds do not prove that the selected
service or lens has continuous coverage. Do not assume a fixed retention
period.
Apply these outcomes before proceeding. Every exit stops the affected profile
queries and produces the Section 5 report; other usable signals may continue
through gcx's bundled debug-with-grafana skill
(gcx agent skills get debug-with-grafana) with the missing-evidence question
made explicit.
EXIT A — profiling unavailable: no target datasource, missing access, or a required CLI capability is unavailable. Record the exact limitation; use
gcx loginandgcx config checkfor missing setup or access, or a compatible gcx build for a CLI mismatch.EXIT B — no ingestion reported: a successful stats response says
dataIngested: false. Report the instrumentation/data gap, not service health.EXIT C — incident not covered: the incident has no overlap with known queryable bounds. Report both ranges; do not replace the incident with today. For partial overlap, analyze only that overlap, record the coverage gap, and limit conclusions to the observed interval.
EXIT D — no usable incident profiles: after checking the selector, window, and lens against discovered facts, incident samples remain absent or zero. A missing baseline alone is handled in Section 2, not by this exit. Report the unresolved coverage/instrumentation gap, not proof of zero cost.
Continue with scoped checks when stats are absent, unsupported, or have unknown bounds. Missing stats alone must not block usable type/profile queries. These queries still need matching samples before they can support attribution.
For query errors, retain the operation and diagnostic. Correct a demonstrated selector/flag mistake; use a documented fallback for unsupported capabilities. Do not retry authentication failures or vary selectors blindly. A failed query is not an empty successful result.
2. Choose the lens and a qualified comparison
Copy exact profile type IDs from discovery, including their units. Discover
labels rather than assuming Prometheus jobs, Tempo service names, Kubernetes
workloads, and Pyroscope service_name have identical values.
| Symptom | Available lens to look for | Interpretation limit |
|---|---|---|
| CPU high or CPU-bound latency | CPU time | Does not measure all request latency, scheduling delay, or throttling |
| Allocation/GC pressure | Allocated bytes/objects | Churn is not retained heap or a memory leak |
| Growing heap/OOM | In-use bytes/objects, alongside allocations | Live-heap samples are snapshots; not process RSS, native memory, or retention ownership |
| Contention or blocked work | Mutex/block delay and counts | Runtime-specific sampling and attribution; not CPU time |
| Suspected goroutine/thread leak | Goroutine/thread counts and stacks | Growth alone is not proof of leaked work |
If the needed lens is absent, record the instrumentation gap; do not substitute CPU to rule out waiting or allocations to prove a leak.
A baseline must represent expected behavior, not simply precede the incident. Prefer equal-duration intervals with comparable request mix/rate, replica count, collection coverage, runtime, and sampling settings. Diurnal workloads may need a matching earlier time of day. Check profile types and data in the baseline window too. Compare an unaffected peer when no historical baseline is suitable. Without a qualified control, report current cost locations without claiming a regression. A stable but inefficient hot path may still explain a new symptom under increased load; an unchanged profile shape does not exonerate it.
For a deployment comparison, keep stable workload labels fixed, but select the old version/pod for the baseline when the incident's version/pod did not exist. Record both selectors and why they are comparable. Never compare an absent old pod/version with a populated new one and call it an infinite regression.
An anomaly result can supply the service, lens, onset, affected labels, and a candidate baseline. Preserve its link, interval, observed/expected values and score if supplied; validate them with profiles and symptom evidence. Read advanced analysis for the anomaly entry path; it requires no anomaly detector to run this skill.
3. Localize the change: service → workload slice
Start with the known suspect, rather than a tenant-wide leaderboard. If the
service is unknown, discover service_name values with profiles labels, then
rank within the known environment; use a tenant-wide query only if necessary.
gcx profiles labels -d <pyro-uid> \
--from <incident-from> --to <incident-to> -o json
gcx profiles labels -d <pyro-uid> --label service_name \
--from <incident-from> --to <incident-to> -o json
# Establish onset and coverage; repeat for the baseline window.
gcx profiles metrics -d <pyro-uid> '{service_name="<suspect>"}' \
--profile-type <lens> --from <incident-from> --to <incident-to> -o json
# Pick a discovered label that can distinguish affected/unaffected workloads.
gcx profiles metrics -d <pyro-uid> '{service_name="<suspect>"}' \
--profile-type <lens> --from <incident-from> --to <incident-to> \
--top --group-by <label> --limit 20 -o jsonUse profiles series to discover actual label combinations for a service
without requiring a profile type. See
scoped series discovery
for label projection. Tenant-wide label inventories alone do not prove labels
coexist on the suspect.
Repeat the chosen grouping for the baseline. Leaderboards are capped candidates, not a fleet census; missing groups may have fallen outside the limit. A single group establishes no peer comparison. Similar totals do not establish uniform per-instance behavior, and the largest group may simply serve more traffic or contain more replicas. Use request counts or replica exposure from existing metrics when needed; if unavailable, state the confounder. Do not use a fixed ratio threshold to declare a slice anomalous.
Use time-series values to check persistence/onset; --top collapses the window.
Keep units and aggregation semantics explicit, especially for live-heap or
count snapshots. Do not sum snapshot values into "bytes allocated" or infer
request-normalized cost from raw profile totals.
4. Locate the changed application stack
Run both queries for the incident selector below and for the qualified baseline selector/window. Omit the slice matcher when analyzing the whole service.
# Rank functions.
gcx profiles query -d <pyro-uid> \
'{service_name="<suspect>",<label>="<value>"}' \
--profile-type <lens> --from <incident-from> --to <incident-to> -o table
# Trace callers and callees of the ranked functions.
gcx profiles query -d <pyro-uid> \
'{service_name="<suspect>",<label>="<value>"}' \
--profile-type <lens> --from <incident-from> --to <incident-to> -o dotTake function rankings and shares from the table. It aggregates each function
and lists the top 20 by SELF. Its PERCENTAGE column is SELF divided by the
profile total, not the function TOTAL share. The table omits everything past
the top 20, so to total the share of a set of functions, such as all GC
functions, sum SELF over the full profile from -o json or a pprof export.
Names longer than 60 characters are cut and end in ...; take the full name
from the matching DOT node before reporting or interpreting it.
Use DOT for caller/callee context, source locations, and full function names.
Its nodes can be single source lines (file.go:line), so one function may
appear as several nodes. A label splits the function name across lines,
starting with the last element of its package path, then reads
self (%) of cumulative (%), or a single value when they are equal. Do not
rank functions or read self shares from DOT nodes. gcx falls back
to table output with a warning when the backend explicitly rejects DOT as
unsupported or returns a flame graph instead. Other errors still fail the query.
Inspect the returned format and retain stderr. JSON encodes flame-graph wire
data, not the human function table; agent output may instead reference a spill
file that must be read.
DOT is pruned by default; dotted edges can skip intermediate frames. When
caller context is missing, repeat the same query with -o dot --max-nodes 250
in both windows. This raises the node limit; it does not guarantee an unpruned
graph. Neither format can rule out a missing path. For ambiguous attribution or
numerical differences, read
pprof comparison and export
both profiles. Do not assume an exported profile repairs collection gaps.
Interpret the evidence with these constraints:
Compare absolute cost and share in each window, with units and a denominator. Equal shares can hide doubled cost; larger shares can reflect other work disappearing. Percentages are not request latency or proof of regression.
Self/flat means work at that frame; total/cumulative includes descendants. Use caller/callee context to locate a meaningful application path. Ancestor totals overlap: do not add them or assign runtime work to a guessed caller.
Runtime symbols suggest mechanisms to test.
mallocgcsuggests allocation work; GC workers may run separately from allocation sites;nanotimealone does not prove busy-waiting. CPU samples infutex/locks do not measure time asleep. Confirm waiting with a supported wait lens and other evidence.In Go, heap stacks identify allocation sites, not the object retaining references. Mutex profiles attribute contention to the holder/unlock path; block profiles to the waiter. Verify the actual runtime semantics before transferring this interpretation to another language or collector.
When a matching checkout/build is available, inspect the implicated function to
validate the mechanism. Read profile locations and verified deployment revision
metadata; do not assume a Build ID is a Git SHA or that service_repository
always exists. Report file:line only when symbolization and revision support it;
otherwise retain function-level attribution and say what is missing. Do not
edit source as part of this investigation.
5. Test the cause and report
Carry the suspect path back to the original symptom. Use the relevant evidence
through gcx's debug-with-grafana skill: request/CPU/heap trends, throttling,
queueing, dependency latency, logs, configuration or deployment changes. Reuse
existing findings; query only what can distinguish the leading explanation from
a material alternative. For a supplied request, see
trace correlation.
A deployment timestamp or detector score is correlation. Strengthen a causal claim with matching onset, a specific mechanism, affected/unaffected controls, and repeatable differences or an already-observed recovery. Do not perform a rollback or load test merely to validate the hypothesis.
Stop when the user's question is answered or missing evidence prevents further attribution. Return a root cause only when the mechanism and symptom connection are supported; otherwise return a suspected cause, cost location, or inconclusive result. Never turn "not observed in these profiles" into "not in this service".
Use this report for every outcome. Keep the field names and order; add details
under Evidence only when needed to support the conclusion. A blocked or empty
investigation is inconclusive, with the exit and missing evidence recorded.
Without a qualified baseline, report measured cost locations without regression
claims. Unknown fields remain explicit; do not fill them with guessed values.
Conclusion: <established cause | suspected cause | cost location |
inconclusive> — <answer to the original question>
Exit: <A | B | C | D | none> — <reason, if applicable>
Scope: <context, datasource UID, service>
Lens: <exact profile type and units>
Incident: <UTC from/to; exact selector; observed coverage>
Baseline: <UTC from/to; exact selector; or unavailable with reason>
Control: <why comparable; workload/collection differences or gaps>
Slice: <affected label/value; evidence of scope or unknown>
Location: <application stack; file:line and revision only if verified>
Cost: <incident vs baseline absolute values, units, aggregation>
Share: <incident vs baseline; self/cumulative and denominator>
Normalization: <method and measured denominator | not applied, with reason>
Mechanism: <supported explanation or explicitly labeled hypothesis>
Evidence: <profile artifacts/links and corroborating symptom evidence>
Counterevidence: <alternatives checked and results | not checked, with reason>
Confidence: <high | medium | low> — <reason tied to available evidence>
Limitations: <coverage, sampling, baseline, symbolization or access gaps>
Next action: <smallest missing evidence or handoff question | none>Files
- ATTRIBUTION.mdAdded by AutoGineer850 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md16.7 KiB
- references/advanced-analysis.md6.5 KiB
LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 Grafana Labs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
The author says: Requires gcx v1.3.0 or later (https://github.com/grafana/gcx) with a context that can query a Grafana Pyroscope datasource. Optional go tool pprof for profile diffs.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Grafana Labs
- Publisher
- Grafana Labs (Official)
- Source
- grafana/skills · skills/grafana-lgtm/performance-rca · commit 8fb72a5
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Grafana Labs.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download performance-rca.zip