AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

linking-errors-to-traces

Links a PostHog error occurrence or session's errors to OpenTelemetry traces, logs with the same trace ID, and Session Replay. Use when the user asks for trace or span IDs on an error, same-trace logs, or backend traces for errors in a session. Starts from an occurrence UUID, session ID, or error tracking issue URL. For a general issue diagnosis or replay summary, use investigating-error-issue or investigating-replay.

Original source
posthog
License
MIT
Pinned revision
cac7c80a9e5b73484d18eda1bffb47297c938e0c

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read posthog--linking-errors-to-traces at revision cac7c80a9e5b73484d18eda1bffb47297c938e0c, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 3

references/finding-exceptions.md

Find exception occurrences

  • For an occurrence UUID, use posthog:execute-sql to select the exact $exception event by uuid.
  • For a UUID-shaped session ID, use posthog:execute-sql to select $exception events with that exact $session_id. Start with a 30-day window and 21 rows. The extra row shows when the first 20 do not cover the session. Narrow or page through the window for a complete list.
  • For a custom session ID, use the exact typed filter below. Session IDs do not have to be UUIDs.

Use this query for a UUID-shaped session. For an occurrence, replace the session predicate with uuid = '<occurrence_uuid>' and use LIMIT 1. Put only a validated UUID in either SQL literal.

posthog:execute-sql
SELECT
    uuid,
    issue_id,
    timestamp,
    properties.$session_id AS session_id,
    properties.$trace_id AS trace_id,
    properties.$span_id AS span_id
FROM events
WHERE event = '$exception'
    AND $session_id = '<session_uuid>'
    AND timestamp >= now() - INTERVAL 30 DAY
ORDER BY timestamp DESC
LIMIT 21

For a custom session ID, call posthog:query-error-tracking-issues-list without putting the ID in SQL:

{
  "dateRange": { "date_from": "-30d" },
  "status": "all",
  "filterTestAccounts": false,
  "filterGroup": [{ "key": "$session_id", "type": "event", "operator": "exact", "value": "<session_id>" }],
  "limit": 20
}

For each returned issue, call posthog:query-error-tracking-issue-events with the same dateRange and filterGroup, filterTestAccounts: false, include: ["exception", "correlation"], and a small limit. Page with offset if hasMore is true and more results matter. Otherwise, state the limit. This path covers grouped issues and sampled events; say that it may miss ungrouped exceptions.