exploring-apm-traces作成者: posthog
PostHog captures distributed traces from OpenTelemetry. Each trace is a tree of spans representing a request’s path through services.
npx skills add https://github.com/posthog/ai-plugin --skill exploring-apm-tracesExploring 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 LLM analytics traces (agent/model $ai_* events and LLM observability tools) or logs (posthog:query-logs, posthog:logs-*).
MCP tools
| Tool | Purpose |
|---|---|
posthog:query-apm-spans | Search and filter spans (analytics-style query; parameters live under query) |
posthog:apm-trace-get | Fetch all spans for a hex trace_id |
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 |
For aggregates or joins not covered by these tools, posthog:execute-sql may be appropriate once the span schema is confirmed for the project.
Span data model
| Field | Description |
|---|---|
trace_id | Hex ID linking spans in one trace |
span_id | Hex ID for this span |
parent_span_id | Parent span hex ID (null for root) |
name | Operation name (e.g. HTTP GET /api/users) |
kind | 0=Unspecified, 1=Internal, 2=Server, 3=Client, 4=Producer, 5=Consumer |
service_name | Emitting service |
status_code | 0=Unset, 1=OK, 2=Error |
timestamp | Start time (ISO 8601) |
end_time | End time (ISO 8601) |
duration_nano | Duration in nanoseconds |
is_root_span | Whether this is the trace entry |
Property filter types (query.filterGroup)
span— built-in fields:trace_id,span_id,duration,name,kind,status_codespan_attribute— span-level attributes (e.g.http.method)span_resource_attribute— resource attributes (e.g. Kubernetes labels)
Workflow: investigate slow requests
- Discover services: call
posthog:apm-services-listwith{}(or applicable filters per tool schema). - Find slow spans:
posthog:query-apm-spanswith aquerythat filters by service andduration(remember nanoseconds: 1s = 1_000_000_000). - Drill in:
posthog:apm-trace-getwith{ "trace_id": "<hex from step 2>" }.
Workflow: find error traces
Use posthog:query-apm-spans with query.filterGroup on status_code exact / numeric operators as appropriate — OpenTelemetry status 2 means error.
Workflow: explore unknown attributes
posthog:apm-attributes-list— narrow keys (e.g. search"http").posthog:apm-attribute-values-list— inspect values for a chosen key.- Build filters in
posthog:query-apm-spansusing the discovered keys.
Reminders
- Prefer discovering attribute keys and services before guessing filters.
- Durations in filters are in nanoseconds.
query-apm-spansexpects aquerywrapper object; defaults often assume a recent time window — tightenquery.dateRangewhen the question implies it.