본문으로 건너뛰기
Skillpedia
데이터베이스41k · #6861

diagnosing-endpoint-performance

하는 일

이 스킬은 느리거나, 시간 초과되거나, 비용이 과도한 특정 엔드포인트 하나를 살펴보고 구체적인 해결책을 추천합니다. PostHog 엔드포인트를 운영하면서 더 빠르거나 저렴한 결과가 필요한 사람을 위한 것입니다.

사용하는 경우

  • ✓엔드포인트가 느리거나 자꾸 시간 초과되어 이유를 알고 싶을 때.
  • ✓엔드포인트가 비용 한도에 도달해서 비용을 낮춰야 할 때.
  • ✓엔드포인트를 구체화된 뷰로 저장해야 하는지 확신이 없을 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/diagnosing-endpoint-performance/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/diagnosing-endpoint-performance/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에서 그대로 가져왔습니다.

Diagnosing endpoint performance

This skill walks through a specific endpoint that is slow, expensive, or unreliable, and produces a concrete recommendation. It is the deep-dive counterpart to auditing-endpoints (which finds candidates).

When to use this skill

  • "This endpoint is slow / timing out"
  • "Why is my endpoint hitting the cost cap?"
  • "Should I materialise X?"
  • An endpoint surfaced from auditing-endpoints as a failing materialisation or expensive caller
  • The user has a specific endpoint in mind and wants advice

If the question is project-wide ("what should I clean up?"), use auditing-endpoints first.

Available tools

Tool Purpose
endpoint-get Full endpoint config: query, current version, data_freshness_seconds, materialisation status
endpoint-versions History of every version (query + materialisation state); which version is current
endpoint-materialization-status Whether materialisation is eligible, current state, last run, last error
endpoints-materialization-preview What the materialised query would look like, plus the rejection reason if ineligible
endpoints-last-execution-times When was it last called (endpoint-level sanity-check that it is in active use)
execute-sql Query query_log for endpoint-level call frequency and per-call duration/bytes

The decision tree

When deciding what to recommend, walk these in order — the first one that applies is the cheapest fix.

Step 1 — Is it cached at all?

Fetch the endpoint and look at data_freshness_seconds (it sets both the cache TTL and, when materialised, the refresh cadence). If the user's traffic calls the same parameters repeatedly within that window, every call after the first is a cache hit and effectively free.

  • TTL is at the default (24h / 86400s) and the data really doesn't need fresher than that → done, no change needed.
  • TTL is at the 900s floor (15 min) and the user is hitting the endpoint many times per minute → bump the TTL. This is almost always the cheapest first move. (data_freshness_seconds is an enum: 900, 1800, 3600, 21600, 43200, 86400, 604800 — there is no sub-15-minute value.)
  • TTL is at the floor because the data must be fresh (e.g. real-time dashboard) → cache won't help, skip to step 2.

The shape of the variables matters here: if every call passes different user_id or date_from values, the cache has many distinct keys and a higher TTL helps less. If almost every call uses the same handful of parameter combinations, the cache helps a lot.

Step 2 — Should it be materialised?

Materialisation pre-computes the query into a saved view that's refreshed on a schedule. Reads become near-instant — at the cost of staleness equal to the refresh interval, plus storage and compute for the materialisation itself.

Call endpoints-materialization-preview. The response tells you:

  • Eligible + clean transform → strong candidate. Recommend enabling, especially for endpoints with predictable filter shapes (variables, breakdowns).
  • Not eligible, with a rejection reason → cannot materialise. The reason often hints at the next step (see step 3 — rewrite).
  • Eligible but the transform is gnarly (lots of range pairs, complex aggregation re-derivation) → materialisation will work but may not save much. Worth flagging before flipping the switch.

When materialisation is enabled, callers must pass all materialised variables — calls without them are rejected (security: prevents returning unfiltered data). Pair the recommendation with a note about which variables become required.

Step 3 — Does the query need rewriting?

For a SQL endpoint that isn't eligible, the rejection reason from endpoints-materialization-preview is the lead. That tool always resolves. Read the reason and match it to the bullets below — they summarise the common cases, not every check the server runs, so the raw reason wins when the two disagree. Propose the rewrite by hand:

  • Cohort breakdown / compare mode rejection → regular property breakdowns materia
자주 묻는 질문

프로젝트 전체를 다루나요?

아니요. 이름이 지정된 엔드포인트 하나에 집중하며, 프로젝트 전체 검토는 별도의 감사 스킬을 씁니다.

구체화란 무엇인가요?

반복 호출을 빠르게 하려고 엔드포인트 결과를 테이블로 저장하는 것이며, 그 대가로 저장소와 컴퓨팅이 듭니다.

언제 감사 스킬을 대신 써야 하나요?

프로젝트 전체에서 정리할 엔드포인트를 찾고 싶을 때 감사를 쓰세요.

상세 정보

작성자의 원본 설명

Diagnose why a PostHog endpoint is slow or expensive and propose a concrete fix — bump the cache TTL, enable materialisation, restructure variables, or rewrite the query. Use when the user says "this endpoint is slow", "my endpoint times out", "we're hitting the cost cap on this one", or asks "should I materialise this?". Focuses on a single named endpoint, not a project-wide audit.

repo: PostHog/posthog

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬