Generated banner for Linking Errors To Traces
Generated logo for Linking Errors To Traces

Linking Errors To Traces

PostHogOfficialPublished by PostHog

  • Skill
  • Workflow
  • Data and AI
  • MIT
  • No issues found

From the author

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.
— the description by PostHog

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for correlating error events in PostHog with backend observability data. By leveraging trace IDs, session IDs, and occurrence UUIDs, it enables users to bridge the gap between frontend error reports and backend execution context. The process involves identifying the specific exception, retrieving associated session recordings, fetching relevant OpenTelemetry traces, and querying logs that share the same trace ID. It emphasizes clear reporting of data gaps and provides a systematic approach to linking disparate diagnostic signals.

What it does

  • Locates specific error occurrences using UUIDs, session IDs, or issue URLs.
  • Retrieves Session Replay recordings associated with an error session.
  • Fetches OpenTelemetry traces linked to an error via trace IDs.
  • Identifies logs sharing the same trace ID to provide backend context.
  • Generates direct links to PostHog error tracking and replay views.
  • Reports on missing data gaps such as unretained spans or missing logs.

When to use it

  • When you need to find the backend trace or span ID for a specific frontend error.
  • When investigating an error and you need to see the user's session recording.
  • When you need to correlate logs with a specific error occurrence.
  • When you have a trace ID and need to find all associated logs across services.

Advantages

  • Reduces manual lookup time by automating the correlation of diagnostic data.
  • Provides a unified view of errors by connecting frontend and backend telemetry.
  • Ensures transparency by explicitly reporting when data is missing or limited.
  • Uses standardized identifiers to ensure accurate data matching.

Usage examples

“Find the backend trace for the error in session 550e8400-e29b-41d4-a716-446655440000.”
The agent will locate the exception event, retrieve the session recording, and attempt to fetch the associated OpenTelemetry trace and logs.
“Show me the logs for trace ID a1b2c3d4e5f6g7h8.”
The agent will query logs filtered by the provided trace ID within a relevant time window around the error occurrence.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/posthog/linking-errors-to-traces/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip linking-errors-to-traces.zip -d .agents/skills

Documentation by PostHog

Use a shared ID to connect records. A matching service and time do not prove that a log or span belongs to an error.

Find the exception

For an issue ID or URL, call posthog:query-error-tracking-issue-events with include: ["exception", "correlation"], filterTestAccounts: false, and a small limit. Choose one occurrence unless the user asks for several. Say when the result is a sample.

For an occurrence ID or session ID, read finding-exceptions.md for the exact lookup. Use the user's time range when given. If no event appears, state the window you checked. Do not claim that an event never existed based on a bounded search.

Follow the IDs

  1. Replay: If the event has $session_id, call posthog:session-recording-get with that ID. found: false means no recording was found; the error or session may still exist. Use posthog:generate-app-url with /replay/{id} when a recording exists.

  2. Exact trace: For each unique, nonzero, 32-character hex $trace_id, call posthog:apm-trace-get with that ID and excludeAttributes: true. Use its _posthogUrl for the trace link. If the event has $span_id, compare it with returned span IDs as hex, ignoring case. An empty result means no retained span was found for that trace ID. Logs may still exist.

  3. Session trace candidates: If an event lacks $trace_id and the user asked about session traces, use posthog:apm-attributes-list to find a span attribute that stores the session ID. If a clear key exists, call posthog:query-apm-spans with an exact span_attribute filter, a short window around the error, flatSpans: true, and a small limit. This finds matching child spans as well as root spans. Call posthog:apm-trace-get for a candidate that needs a link. Label these as session matches. Time alone does not prove which request raised the error.

  4. Same-trace logs: When an event has a trace ID, read finding-trace-logs.md for the bounded service lookup and exact log filter. Include every severity, including info. A trace can have logs even when no span was retained.

Use posthog:generate-app-url with /error-tracking/{id} when the issue ID is known. Do not build PostHog links by hand.

Report the result

For each checked occurrence, show the error time, IDs used for the join, and links to the issue, replay, and retained trace when available. Summarize matching logs with their time and severity. Exclude secrets and unneeded personal data from log excerpts.

Name each gap separately: no trace ID on the event, trace ID but no retained span, no session attribute on spans, no recording, or no logs with that trace ID in the checked window. A session-matched span is a candidate until an exact trace or span ID connects it to the error. State any row limit or time range that kept the search from being complete. If a lookup fails, say that its result is unknown instead of reporting that no matching data exists.

Files

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.

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
PostHog
Publisher
PostHog (Official)
Source
PostHog/skills · skills/omnibus/linking-errors-to-traces · commit a5d30e7
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by PostHog or PostHog.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download linking-errors-to-traces.zip