posthog/ai-plugin

exploring-endpoint-execution-logs

Explore and diagnose a PostHog endpoint's execution logs — error messages, failed runs, cache misses, slow runs, or unexpected row counts during endpoint invocations.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/posthog/ai-plugin --skill exploring-endpoint-execution-logs

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Exploring endpoint execution logs

Every endpoint run emits one execution log entry to PostHog's log_entries store. This skill reads those entries for a specific endpoint to answer "what happened when it ran?". It is the log-level counterpart to diagnosing-endpoint-performance (which reasons about cache/materialisation strategy from config and query_log).

When to use this skill

  • "Why is my endpoint failing / erroring?"
  • "Show me the logs / recent runs for endpoint X"
  • "Did the last run hit cache? How many rows did it return?"
  • "What happened the last time endpoint Y ran?"

If the question is "this endpoint is slow, what should I change?", use diagnosing-endpoint-performance. If it's project-wide ("what can I clean up?"), use auditing-endpoints.

What an execution log entry looks like

Each run produces exactly one entry. The level is INFO on success and ERROR on failure, and the message carries the extra data as searchable key=value tokens:

text
Endpoint executed · path=materialized cache=hit duration_ms=142 rows=1024 version=3
Endpoint execution failed · path=inline error=ResolutionError version=3

Token meanings:

TokenValuesMeaning
pathmaterialized / inline / ducklake / ducklake_fallbackWhich execution path ran
cachehit / missWhether the query result cache was used (omitted for ducklake)
duration_msintegerWall-clock execution time
rowsintegerNumber of result rows returned
versionintegerWhich endpoint version ran
errore.g. ResolutionError, HogVMExceptionError class / HogQL code name (failures only)

Each run gets a distinct instance_id, so logs group one-per-execution in the viewer.

Available tools

ToolPurpose
endpoint-logsPrimary. Execution log entries for one endpoint by name. Filter by level, search, time range, instance_id; limit up to 500.
endpoint-getEndpoint config for context (current version, materialisation, query kind)
execute-sqlFallback / aggregation directly against log_entries (log_source='endpoints')

Filtering

endpoint-logs exposes the standard log filters:

  • level — comma-separated, e.g. ERROR to see only failed runs, or INFO,ERROR for all.
  • search — case-insensitive substring over the message. Because the extra data is in

key=value tokens, you can search cache=miss, path=inline, error=ResolutionError, or a specific version=3.

  • after / before — ISO timestamps to bound the time range.
  • instance_id — pin a single execution.
  • limit — 1–500 (default 50).

Workflow

  1. Identify the endpoint by name. If given a URL, parse it from

/api/projects/{team_id}/endpoints/{name}/run.

  1. Start broad: endpoint-logs for the endpoint with a recent time range. Skim levels and tokens.
  2. Narrow to the symptom:
  • Failures → level=ERROR; read the error= token and path= to see where it broke.
  • Cache concerns → search=cache=miss to see how often runs miss cache.
  • Wrong results → compare rows= across runs, and version= to spot a regression after a

version bump.

  1. For counts/trends across many runs (e.g. error rate over a week), drop to execute-sql against

log_entries:

sql
   SELECT toDate(timestamp) AS day, upper(level) AS level, count() AS runs
   FROM log_entries
   WHERE log_source = 'endpoints' AND log_source_id = '<endpoint_uuid>'
   GROUP BY day, level ORDER BY day DESC

Get the endpoint UUID from endpoint-get (the log_source_id is the endpoint id, not its name).

  1. Summarize: what's failing, since when, on which version/path, and whether it's a config issue

(hand off to diagnosing-endpoint-performance) or a query bug.

Example interaction

text
User: "weekly_signups started erroring this morning"

Agent steps:
- endpoint-logs weekly_signups, level=ERROR, after=<this morning>
  → several "Endpoint execution failed · path=inline error=ResolutionError version=5"
- endpoint-get weekly_signups → current version is v5 (bumped today)
- endpoint-logs weekly_signups, level=INFO, before=<this morning>
  → prior runs: "path=inline cache=hit ... version=4" succeeded

- "v5 (created this morning) is failing with a ResolutionError on the inline path — it can't
   resolve a table or field reference. v4 ran fine. This looks like a bad query in the new
   version. Want me to pull the v5 query (endpoint-versions) so we can fix it, or roll back to v4?"

Important notes

  • One entry per run. Don't expect step-by-step traces — endpoints log a single completion line.

The detail lives in the tokens, not in multiple lines.

  • `log_source_id` is the endpoint UUID, not the name. For execute-sql, fetch it via

endpoint-get first.

  • Logs are retained ~90 days (the log_entries TTL). Older runs won't appear.
  • Execution logs ≠ query performance. endpoint-logs tells you what happened and why a run

failed; for "should I materialise / bump cache TTL?" use diagnosing-endpoint-performance, which reasons over config and query_log cost metrics.

  • Best-effort emission. A log line is emitted after each run but never blocks it — if a run

succeeded for the caller but no log shows, the emit was dropped, not the query.

タスクに関連する項目

同じリポジトリから

関連する Skills

すべての Skills
posthog
公式

composing-grid-canvases

Compose PostHog grid canvases — widget grids (including the user's home canvas) built from reusable component canvases. Use when a task asks to add, fill, move, resize, or remove a widget on a grid or home canvas, to compose a whole canvas of widgets from one ask, to build a reusable widget/component, or when a placement id or grid canvas id is the target. Covers the component store search → configure → fork → build ladder, the component placement contract (size, configSchema), the placement lif

1時間の導入数
1
GitHub Stars
96
更新日
10月31日
posthog
公式

consuming-endpoints-from-client-code

Wire a PostHog endpoint into a client app or SDK. Covers fetching the OpenAPI spec, generating a typed client with openapi-generator or @hey-api/openapi-ts, sending the right auth header, shaping the variables payload (HogQL codename vs insight breakdown property), handling rate-limit and materialised-endpoint error responses. Use when the user says "how do I call my endpoint", "generate a client for this", or "what auth header do I use".

1時間の導入数
1
GitHub Stars
96
更新日
10月31日
posthog
公式

designing-email-templates

Author, save, and edit email templates in the PostHog workflows library — compose email design JSON with Liquid personalization and create and round-trip-edit templates over MCP. Use when asked to design, build, update, or fix an email template for workflows, broadcasts, or campaigns.

1時間の導入数
1
GitHub Stars
96
更新日
10月31日
posthog
公式

exploring-llm-evaluations

Investigate AI observability evaluations — hog (deterministic code-based), llmjudge (LLM-prompt-based), and sentiment (user-message sentiment). Find existing evaluations, inspect their configuration, run them against specific generations, query individual results, and set up scheduled reports on an evaluation. Use when the user asks to debug why an evaluation is failing, surface common failure modes, compare results across filters, dry-run a Hog evaluator, prototype a new LLM-judge prompt, inspe

1時間の導入数
1
GitHub Stars
96
更新日
10月31日