exploring-apm-traces
What it does
This skill shows an agent how to dig into PostHog's performance data for backend services, such as request timing and errors. It is for developers and operators trying to find why an app is slow or failing.
When to use it
- βWhen you ask why a service is slow or returning errors.
- βWhen you need to find the slowest database calls or web requests in your app.
- βWhen you want to look up a specific trace ID and see its full request path.
Skill link
https://github.com/PostHog/posthog/blob/master/products/tracing/skills/exploring-apm-traces/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWhy has my checkout service been slow today? Please check the traces and find which calls are taking the most time.β
5 new skills a week. 1 minute to read.
How it works
The agent checks overall service health first, then searches the spans, which are the timed steps inside each request. It can open a full trace to see the path a single request took.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Exploring APM traces (OpenTelemetry spans)
PostHog captures distributed traces from OpenTelemetry. Each trace is a tree of spans representing a request's path through services.
Disambiguation: This skill is for APM / OpenTelemetry traces. Do not confuse with AI observability traces (agent/model $ai_* events) or logs (posthog:query-logs, posthog:logs-*).
Governed metric first
When the question asks for SLO burn, call posthog:metric-list before the APM tools and look for slo_explicit_burn_by_operation. Run an approved, non-drifted match with posthog:data-catalog-metric-run for the canonical headline. If the user also asks which operation drives the burn, answer the headline first, then use the aggregate and trace workflows below for a noncanonical breakdown. If no governed metric matches, say so and label the derived measure noncanonical.
Available tools
| Tool | Purpose |
|---|---|
posthog:apm-service-health |
Status per service against a baseline: start here |
posthog:query-apm-spans |
Search and filter spans (compact list view) |
posthog:apm-trace-get |
Get the full span list for one hex trace_id |
posthog:apm-spans-aggregate |
Per-operation aggregates (count, p50/p95, errors) |
posthog:apm-spans-tree |
Call-tree aggregates per (parent, child) edge |
posthog:apm-spans-count |
Scalar span count β cheap filter pre-flight |
posthog:apm-spans-sparkline |
Span counts over time (zero-filled time series) |
posthog:apm-spans-duration-histogram |
Trace counts per log-scale duration bucket |
posthog:apm-attribute-breakdown |
Span counts grouped by one attribute's value |
posthog:apm-services-list |
List distinct service names |
posthog:apm-attributes-list |
List span or resource attribute keys |
posthog:apm-attribute-values-list |
List values for a specific attribute key |
See references/spans-and-fields.md for the response schema and the kind/status_code enums.
Workflow: debug a trace from a URL
Step 1 β Fetch the trace
posthog:apm-trace-get
{
"trace_id": "<hex_trace_id>"
}
The response is { results: [span, span, β¦], _posthogUrl: "β¦" } β a flat list of every span in the trace.
The list can be very large for fan-out request flows; when it exceeds the inline limit, Claude Code auto-persists it to a file.
From the result you get:
- Every span with
name,service_name,kind,status_code,parent_span_id,duration_nano,is_root_span - The
_posthogUrlβ a deep link to this trace in the tracing UI; always include this in your response so the user can click through
Step 2 β Parse large results with scripts
When the result is persisted to a file (traces with hundreds of spans across services), use the parsing scripts to explore it.
Start with the summary to get the full picture, then drill into specifics:
# 1. Overview: services, span count, slowest spans, errors
python3 scripts/print_summary.py /path/to/persisted-file.json
# 2. Indented chronological tree (DFS by parent_span_id)
python3 scripts/print_timeline.py /path/to/persisted-file.json
# 3. Drill into a specific span by name
SPAN="HTTP GET /api/users" python3 scripts/extract_span.py /path/to/persisted-file.json
# 4. Search for a keyword across span names, services, IDs
SEARCH="keyword" python3 scripts/search_spans.py /path/to/persisted-file.json
# 5. When the JSON shape looks unfamiliar
python3 scripts/show_structure.py /path/to/persisted-file.json
All scripts support MAX_LEN=N env var to control truncation (0 = unlimited).
Tree reconstruction (parent_span_id β span_id)
The flat span list is a tree. Each span carries:
trace_idβ same on every span in the tracespan_idβ this span's unique hex IDparent_span_idβ points to the parent'sspan_id(zero-padded hex000β¦000for the root)is_root_spanβ convenience flag for the trace entry
To rebuild the tree:
- Spans where
is_root_spanis true (orparent_span_id == "00000000β¦") are root spans. - Every other span is a child of the s
FAQ
Is this the same as AI traces or product logs?
No. This skill covers performance traces from OpenTelemetry, not AI model traces or general logs.
Where should the agent start?
It starts with service health, which compares each service to a baseline before it looks at details.
Does it check for an official metric first?
Yes. For SLO burn questions, it looks for an approved PostHog metric and uses it for the main answer.
Details
Original description by the author
Investigates distributed application performance using PostHog APM (OpenTelemetry span) data via MCP. Use when the user asks about service traces, slow HTTP/database spans, error spans, error-rate trends or spikes, latency distributions, trace IDs, or span attributes β not AI observability traces or product logs. Uses posthog:apm-service-health, posthog:query-apm-spans, posthog:apm-trace-get, posthog:apm-spans-sparkline, posthog:apm-services-list, posthog:apm-attributes-list, and posthog:apm-attribute-values-list.
repo: PostHog/posthog
Popularity
- GitHub stars
- 41k
- Ranking position
- #6964
- License
- β
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
depot-ci
41kHelps your agent set up and run Depot CI workflows, a GitHub Actions alternative, including migrating existing workflows and reading run logs.
depot-container-builds
41kHelps your agent build Docker images on Depot's remote builders, including multi-platform images, pushing to registries, and fixing build failures.
depot-github-runners
41kHelps your agent move GitHub Actions jobs to Depot-managed runners, choosing runner sizes and labels, and troubleshooting runner setup issues.
editing-agents-md
41kHelps your agent decide whether a rule belongs in an AGENTS.md or CLAUDE.md file, and write it so it sticks without bloating the file.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.