Aller au contenu
Skillpedia
Bases de données41k · #6861

diagnosing-endpoint-performance

Ce qu’il fait

Cette skill examine un endpoint précis qui est lent, dépasse le délai ou coûte trop cher, et recommande une correction concrète. Elle s'adresse aux personnes qui font fonctionner des endpoints PostHog et ont besoin de résultats plus rapides ou moins coûteux.

Quand l’utiliser

  • ✓Quand un endpoint est lent ou dépasse régulièrement le délai et que vous voulez en connaître la raison.
  • ✓Quand un endpoint atteint sa limite de coût et que vous devez le réduire.
  • ✓Quand vous ne savez pas si un endpoint devrait être stocké comme vue matérialisée.

Lien du skill

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

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/diagnosing-endpoint-performance/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Mon endpoint des ventes dépasse le délai chaque matin. Peux-tu trouver pourquoi et ce qu'il faut modifier ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

La skill vérifie la configuration de l'endpoint, l'historique de ses versions et l'état de sa matérialisation, puis recommande une modification, comme un cache plus long, des résultats stockés ou une requête plus simple.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes

Couvre-t-elle tout le projet ?

Non. Elle se concentre sur un endpoint nommé, et une autre skill d'audit sert à passer en revue l'ensemble du projet.

Qu'est-ce que la matérialisation ?

C'est le stockage des résultats de l'endpoint dans une table, pour accélérer les appels répétés, au prix du stockage et du calcul.

Quand utiliser plutôt la skill d'audit ?

Utilisez l'audit lorsque vous voulez repérer les endpoints à nettoyer dans tout le projet.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
41k
Position au classement
#6861
Licence
—
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires