get-profile-hotpath
Skill5 starsChanged 5 months agoMITView on GitHub
Fetch and display the hot path from an Application Insights Profiler trace. Use this when asked to get the profiler hot path, call tree, or trace analysis for an App Insights resource.
In this repository9 other files it gives its agents.
- agentic-optimizationSkill
- deep-analysisSkill
- download-profile-traceSkill
- download-snapshotSkill
- enable-profilerSkill
- enable-snapshot-debuggerSkill
- error-explorationSkill
- get-snapshot-debug-infoSkill
- perf-optimizationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Follow the Standard Skill Preamble to check for existing investigation context and gather inputs.
- Distinctive: line 25
If the user doesn't have a trace location ID, help them find one by querying profiler samples — see find-profiler-traces.md.
- Distinctive: line 33
If you need finer control or want to debug individual steps, the granular scripts below remain available.
- Very specific: line 44
Run the script in get-metadata.md to call the profileTreeMetadata endpoint and extract the redisCacheRegion value.
- Very specific: line 48
Run the script in trigger-trace-analysis.md to POST to the profileTreeDefinitions endpoint.
- Very specific: line 54
If step 5 returned 202(analysis newly triggered), run the script in poll-analysis-status.md to poll the profileTreeComputeStatus endpoint …
- Very specific: line 58
Run the script in get-profile-tree.md to call the profileTreeDefinitions GET endpoint.
- Distinctive: line 82
If you still see persistent 401s after the script update:
- Very specific: line 84
Verify the user is logged in: az account show
- Very specific: line 86
Ensure the correct subscription is selected: az account set --subscription <subscription-id>
- Very specific: line 91
If the profileTreeComputeStatus endpoint still returns Running after the polling loop exhausts all attempts (default: 45 attempts / ~90 …
- Very specific: line 99
If the profileTreeComputeStatus endpoint returns Failed:
- Distinctive: line 107
If the root tree has very few nodes or the hot path is unexpectedly short:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Get Profile Hot Path
This skill fetches the hot path call tree from an Application Insights Profiler trace using the dataplane REST API directly.
Prerequisites
- The user must be logged in to Azure CLI (
az login) - The user must provide an Application Insights app ID (GUID) and a trace location ID (the
ServiceProfilerContentvalue from a profiler sample)
Steps
1–2. Check investigation notes and gather inputs
Follow the Standard Skill Preamble to check for existing investigation context and gather inputs.
In addition to the standard App ID, this skill requires:
- Trace location ID: The full
ServiceProfilerContentstring. See trace-location-id-format.md for the format specification.
If the user doesn't have a trace location ID, help them find one by querying profiler samples — see find-profiler-traces.md.
3–8. Fetch the hot path (combined pipeline)
For efficiency, use the combined pipeline script get-hotpath-pipeline.md which performs steps 3–8 in a single PowerShell block: token acquisition → metadata → trigger → poll → root tree → child node expansion. This is the preferred approach — it reduces tool calls from 5–6 down to 1–2.
User communication: The hot path pipeline may take 1–2 minutes for fresh traces (triggering analysis, polling for completion, expanding child nodes). Before starting the pipeline, inform the user that this is a multi-step process and they should expect to wait. Provide periodic status updates based on the script's output (e.g., "Analysis triggered, polling for completion...", "Expanding call tree — round 3 of 10..."). If the trace was previously analyzed, cached results return in seconds.
If you need finer control or want to debug individual steps, the granular scripts below remain available.
<details>
<summary>Individual steps (3–8) for debugging</summary>3. Acquire an access token
Run the script in get-access-token.md to acquire a Bearer token for the profiler dataplane. See the token freshness and session scoping guidance in that document — re-acquire the token in the same command block as each API call. This is especially critical during the polling loop in step 6, which may run for over a minute.
4. Fetch the Redis cache region
Run the script in get-metadata.md to call the profileTreeMetadata endpoint and extract the redisCacheRegion value.
5. Trigger trace analysis
Run the script in trigger-trace-analysis.md to POST to the profileTreeDefinitions endpoint. This triggers the trace analysis using the traceLocationId and redisCacheRegion.
302 redirect handling: When the analysis results already exist, the POST returns a 302 redirect. The script disables auto-redirect (
-MaximumRedirection 0) and manually follows theLocationheader with theAuthorizationheader preserved. If you get the profile tree back directly from the 302 path, you can skip steps 6 and 7.
6. Poll for analysis completion
If step 5 returned 202(analysis newly triggered), run the script in poll-analysis-status.md to poll the profileTreeComputeStatus endpoint until the analysis is complete. This must succeed before fetching the profile tree.
7. Fetch the root profile tree
Run the script in get-profile-tree.md to call the profileTreeDefinitions GET endpoint. This returns the root call tree with the HotPath array (node indices) and top-level Nodes.
8. Fetch child nodes to complete the hot path
The root tree usually only contains the first 1–2 levels of nodes. The remaining nodes in the HotPath are referenced by index in ChildReferences but not inline. Run the script in get-child-nodes.md iteratively to expand them.
</details>9. Present the hot path
Once all hot path nodes are loaded, present the result using the format described in present-hotpath.md.
Response format
See present-hotpath.md for how to interpret the profile tree JSON and display the hot path as a human-readable call tree.
Troubleshooting
401 Unauthorized during polling (302 redirect)
The most common cause of 401 errors during the polling loop (step 6) is 302 redirect auth stripping. When the analysis completes, the status endpoint returns a 302 redirect to the profile tree result. PowerShell's Invoke-RestMethod automatically follows the redirect but strips the Authorization header, causing a 401 on the redirected URL.
The updated polling script in poll-analysis-status.md handles this by using Invoke-WebRequest -MaximumRedirection 0 to detect the 302 as a completion signal without following it.
If you still see persistent 401s after the script update:
- Verify the user is logged in:
az account show - Re-authenticate:
az login - Ensure the correct subscription is selected:
az account set --subscription <subscription-id> - Try acquiring the token manually and check for errors:
az account get-access-token --resource "api://dataplane.diagnosticservices.azure.com"
Analysis still "Running" after polling timeout
If the profileTreeComputeStatus endpoint still returns Running after the polling loop exhausts all attempts (default: 45 attempts / ~90 seconds):
- Wait and retry — large traces take longer to analyze. Wait 30–60 seconds, then re-acquire a fresh token and try a direct GET on the
profileTreeDefinitionsendpoint (step 7). If the analysis completed in the background, the GET will return the root tree directly. - Try a different trace — if the trace is unusually large or corrupted, try a different profiler trace from the same time window. Shorter traces analyze faster.
- Re-trigger the analysis — POST to the
profileTreeDefinitionsendpoint again (step 5). If the analysis completed, you'll get a 302 redirect to the cached result.
Analysis returns "Failed"
If the profileTreeComputeStatus endpoint returns Failed:
- Try a different trace — the trace data may be corrupted or incomplete.
- Check the trace time window — very old traces may have expired from storage.
- Try with
showFrameworkDependencies: true— in rare cases, changing this parameter can resolve analysis failures.
Empty or minimal root tree
If the root tree has very few nodes or the hot path is unexpectedly short:
- Expand child nodes — the root tree only includes 1–2 levels. Follow
ChildReferencesusing get-child-nodes.md to get the full tree. - Check the trace duration — very short traces (< 100ms) may not have enough samples for a meaningful call tree.
- Try with framework dependencies — set
showFrameworkDependencies: truein the trigger request to include runtime frames that may reveal hidden bottlenecks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

