본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)41k · #6964

exploring-apm-traces

하는 일

이 스킬은 요청 시간이나 오류 같은 백엔드 서비스의 PostHog 성능 데이터를 에이전트가 파고드는 방법을 보여 줍니다. 앱이 왜 느리거나 실패하는지 찾으려는 개발자와 운영자를 위한 스킬입니다.

사용하는 경우

  • ✓서비스가 왜 느린지, 또는 왜 오류를 반환하는지 묻고 싶을 때.
  • ✓앱에서 가장 느린 데이터베이스 호출이나 웹 요청을 찾고 싶을 때.
  • ✓특정 트레이스 ID를 조회해 단일 요청의 전체 경로를 보고 싶을 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/tracing/skills/exploring-apm-traces/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/tracing/skills/exploring-apm-traces/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“오늘 체크아웃 서비스가 느려졌습니다. 트레이스를 확인해서 시간이 가장 많이 걸리는 호출을 찾아 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 전체 서비스 상태를 확인합니다. 그다음 각 요청 안의 시간 측정 단계인 스팬을 검색하고, 필요하면 전체 트레이스를 열어 단일 요청이 거친 경로를 봅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 trace
  • span_id — this span's unique hex ID
  • parent_span_id — points to the parent's span_id (zero-padded hex 000…000 for the root)
  • is_root_span — convenience flag for the trace entry

To rebuild the tree:

  1. Spans where is_root_span is true (or parent_span_id == "00000000…") are root spans.
  2. Every other span is a child of the s
자주 묻는 질문

이것은 AI 트레이스나 제품 로그와 같은가요?

아니요. 이 스킬은 AI 모델 트레이스나 일반 로그가 아니라 OpenTelemetry의 성능 트레이스를 다룹니다.

에이전트는 어디서 시작하나요?

기준선과 비교해 각 서비스의 상태를 먼저 확인한 뒤 세부 사항을 봅니다.

공식 지표를 먼저 확인하나요?

네. SLO 소진 질문이라면 승인된 PostHog 지표를 찾고, 주된 답변에 그것을 사용합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
41k
순위
#6964
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬