linking-errors-to-traces
Skill này làm gì
Skill này liên kết một lỗi với trace backend, nhật ký và bản ghi phiên có chung ID với nó. Nó dành cho lập trình viên muốn theo dõi một vấn đề từ front end vào tới máy chủ.
Khi nào nên dùng
- ✓Khi bạn muốn trace ID hoặc span ID cho một lần xuất hiện lỗi cụ thể.
- ✓Khi bạn cần các nhật ký backend có chung trace ID với một lỗi.
- ✓Khi bạn muốn xem session replay và các trace backend cho các lỗi trong cùng một phiên.
Liên kết skill
https://github.com/PostHog/posthog/blob/master/products/error_tracking/skills/linking-errors-to-traces/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tìm trace và nhật ký backend thuộc về lần xuất hiện lỗi này, để tôi có thể xem máy chủ đã làm gì.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill bắt đầu từ một lỗi hoặc ID phiên, lần theo trace ID chung đến các span và nhật ký khớp, rồi kiểm tra session replay. Skill chỉ liên kết các bản ghi có chung ID, không liên kết những bản ghi chỉ xảy ra vào thời điểm tương tự.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Link errors to traces and logs
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
- Replay: If the event has
$session_id, callposthog:session-recording-getwith that ID.found: falsemeans no recording was found; the error or session may still exist. Useposthog:generate-app-urlwith/replay/{id}when a recording exists. - Exact trace: For each unique, nonzero, 32-character hex
$trace_id, callposthog:apm-trace-getwith that ID andexcludeAttributes: true. Use its_posthogUrlfor 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. - Session trace candidates: If an event lacks
$trace_idand the user asked about session traces, useposthog:apm-attributes-listto find a span attribute that stores the session ID. If a clear key exists, callposthog:query-apm-spanswith an exactspan_attributefilter, a short window around the error,flatSpans: true, and a smalllimit. This finds matching child spans as well as root spans. Callposthog:apm-trace-getfor a candidate that needs a link. Label these as session matches. Time alone does not prove which request raised the error. - 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.
Câu hỏi thường gặp
Vì sao cần một ID chung?
Chỉ khớp theo dịch vụ và thời gian có thể liên kết nhầm bản ghi, nên skill yêu cầu một trace ID chung.
Nếu không tìm thấy trace thì sao?
Skill báo cáo khoảng thời gian đã tìm kiếm. Nhật ký vẫn có thể tồn tại dù không tìm thấy span nào.
Skill có thể đưa ra chẩn đoán tổng quát không?
Không. Để có chẩn đoán tổng quát hoặc tóm tắt replay, các skill điều tra lỗi khác được dùng.
Chi tiết
Mô tả gốc của tác giả
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.
repo: PostHog/posthog
Độ phổ biến
- Sao GitHub
- 41k
- Vị trí xếp hạng
- #6871
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
depot-ci
41kGiúp agent của bạn thiết lập và chạy quy trình Depot CI, một lựa chọn thay thế GitHub Actions, gồm chuyển các quy trình hiện có và đọc nhật ký chạy.
depot-container-builds
41kGiúp agent của bạn build image Docker trên các builder từ xa của Depot, gồm image đa nền tảng, đẩy lên registry và sửa lỗi build.
depot-github-runners
41kGiúp agent của bạn chuyển các job GitHub Actions sang runner do Depot quản lý, chọn kích thước và nhãn runner, và xử lý lỗi thiết lập runner.
editing-agents-md
41kGiúp agent của bạn quyết định một quy tắc nên nằm trong file AGENTS.md hay CLAUDE.md, và viết sao cho quy tắc được tuân thủ mà file không bị phình to.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.