exploring-endpoint-execution-logs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExploring endpoint execution logs
探索端点执行日志
Every endpoint run emits one execution log entry to PostHog's store. This skill
reads those entries for a specific endpoint to answer "what happened when it ran?". It is the
log-level counterpart to (which reasons about cache/materialisation
strategy from config and ).
log_entriesdiagnosing-endpoint-performancequery_log每次端点运行都会向PostHog的存储中写入一条执行日志条目。本技能读取特定端点的这些条目,以回答“运行时发生了什么?”的问题。它是(从配置和分析缓存/物化策略)在日志层面的对应技能。
log_entriesdiagnosing-endpoint-performancequery_logWhen 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
. If it's project-wide ("what can I clean up?"), use
.
diagnosing-endpoint-performanceauditing-endpoints- “为什么我的端点运行失败/报错?”
- “展示端点X的日志/最近运行记录”
- “上次运行是否命中缓存?返回了多少行数据?”
- “端点Y上次运行时发生了什么?”
如果问题是“这个端点运行缓慢,我应该做什么调整?”,请使用。如果是项目范围的问题(“我可以清理哪些内容?”),请使用。
diagnosing-endpoint-performanceauditing-endpointsWhat an execution log entry looks like
执行日志条目的格式
Each run produces exactly one entry. The level is on success and on failure, and the
message carries the extra data as searchable tokens:
INFOERRORkey=valuetext
Endpoint executed · path=materialized cache=hit duration_ms=142 rows=1024 version=3
Endpoint execution failed · path=inline error=ResolutionError version=3Token meanings:
| Token | Values | Meaning |
|---|---|---|
| | Which execution path ran |
| | Whether the query result cache was used (omitted for ducklake) |
| integer | Wall-clock execution time |
| integer | Number of result rows returned |
| integer | Which endpoint version ran |
| e.g. | Error class / HogQL code name (failures only) |
Each run gets a distinct , so logs group one-per-execution in the viewer.
instance_id每次运行都会生成恰好一条日志条目。成功时级别为,失败时为,消息中携带可搜索的格式扩展数据:
INFOERRORkey=valuetext
Endpoint executed · path=materialized cache=hit duration_ms=142 rows=1024 version=3
Endpoint execution failed · path=inline error=ResolutionError version=3各字段含义:
| 字段(Token) | 取值范围 | 含义 |
|---|---|---|
| | 运行的执行路径类型 |
| | 是否使用了查询结果缓存(ducklake路径不包含此字段) |
| 整数 | 实际执行时间(毫秒) |
| 整数 | 返回的结果行数 |
| 整数 | 运行的端点版本号 |
| 例如 | 错误类/HogQL代码名称(仅失败条目包含) |
每次运行都有一个唯一的,因此在日志查看器中,每条日志对应一次执行。
instance_idAvailable tools
可用工具
| Tool | Purpose |
|---|---|
| Primary. Execution log entries for one endpoint by name. Filter by level, search, time range, instance_id; |
| Endpoint config for context (current version, materialisation, query kind) |
| Fallback / aggregation directly against |
| 工具名称 | 用途 |
|---|---|
| 核心工具。按名称查询单个端点的执行日志条目。可按级别、关键词、时间范围、instance_id过滤; |
| 获取端点配置信息以了解上下文(当前版本、物化方式、查询类型) |
| 备选/聚合工具,直接查询 |
Filtering
过滤规则
endpoint-logs- level — comma-separated, e.g. to see only failed runs, or
ERRORfor all.INFO,ERROR - search — case-insensitive substring over the message. Because the extra data is in
tokens, you can search
key=value,cache=miss,path=inline, or a specificerror=ResolutionError.version=3 - after / before — ISO timestamps to bound the time range.
- instance_id — pin a single execution.
- limit — 1–500 (default 50).
endpoint-logs- level — 逗号分隔,例如仅查看失败运行记录,
ERROR查看所有记录。INFO,ERROR - search — 对消息内容进行不区分大小写的子串搜索。由于扩展数据采用格式,你可以搜索
key=value、cache=miss、path=inline或特定版本error=ResolutionError。version=3 - after / before — ISO格式时间戳,用于限定时间范围。
- instance_id — 定位单次执行记录。
- limit — 1–500(默认值为50)。
Workflow
工作流程
-
Identify the endpoint by name. If given a URL, parse it from.
/api/projects/{team_id}/endpoints/{name}/run -
Start broad:for the endpoint with a recent time range. Skim levels and tokens.
endpoint-logs -
Narrow to the symptom:
- Failures → ; read the
level=ERRORtoken anderror=to see where it broke.path= - Cache concerns → to see how often runs miss cache.
search=cache=miss - Wrong results → compare across runs, and
rows=to spot a regression after a version bump.version=
- Failures →
-
For counts/trends across many runs (e.g. error rate over a week), drop toagainst
execute-sql:log_entriessqlSELECT 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 DESCGet the endpoint UUID from(theendpoint-getis the endpoint id, not its name).log_source_id -
Summarize: what's failing, since when, on which version/path, and whether it's a config issue (hand off to) or a query bug.
diagnosing-endpoint-performance
-
确定端点名称。如果提供的是URL,从中解析端点名称。
/api/projects/{team_id}/endpoints/{name}/run -
先进行宽泛查询:使用查询该端点近期的日志,浏览日志级别和字段信息。
endpoint-logs -
根据症状缩小范围:
- 失败问题 → 设置;查看
level=ERROR字段和error=字段以确定故障位置。path= - 缓存相关问题 → 设置以查看未命中缓存的运行频率。
search=cache=miss - 结果异常问题 → 对比不同运行的字段,结合
rows=字段排查版本更新后的回归问题。version=
- 失败问题 → 设置
-
如需统计多次运行的趋势(例如一周内的错误率),使用查询
execute-sql表:log_entriessqlSELECT 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端点UUID可通过获取(endpoint-get为端点ID,而非端点名称)。log_source_id -
总结结论:明确故障内容、起始时间、涉及的版本/路径,并判断是配置问题(转交至处理)还是查询Bug。
diagnosing-endpoint-performance
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?"text
用户:“weekly_signups从今天早上开始报错了”
Agent步骤:
- 调用endpoint-logs查询weekly_signups,设置level=ERROR,after=<今天早上>
→ 返回多条“Endpoint execution failed · path=inline error=ResolutionError version=5”
- 调用endpoint-get查询weekly_signups → 当前版本为v5(今日更新)
- 调用endpoint-logs查询weekly_signups,设置level=INFO,before=<今天早上>
→ 之前的运行记录:“path=inline cache=hit ... version=4”均成功
- 回复:“今日早上更新的v5版本在inline路径下运行失败,报错为ResolutionError——无法解析表或字段引用。v4版本运行正常。这看起来是新版本中的查询语句存在问题。需要我获取v5版本的查询语句(通过endpoint-versions)来修复,还是回滚到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.
- is the endpoint UUID, not the name. For
log_source_id, fetch it viaexecute-sqlfirst.endpoint-get - Logs are retained ~90 days (the TTL). Older runs won't appear.
log_entries - Execution logs ≠ query performance. tells you what happened and why a run failed; for "should I materialise / bump cache TTL?" use
endpoint-logs, which reasons over config anddiagnosing-endpoint-performancecost metrics.query_log - 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.
- 每次运行对应一条日志。不要期望得到分步追踪信息——端点仅记录一条完成状态日志。详细信息存储在字段中,而非多行日志。
- 是端点UUID,而非端点名称。使用
log_source_id前,需先通过execute-sql获取该ID。endpoint-get - 日志保留约90天(表的TTL)。更早的运行记录无法查询。
log_entries - 执行日志≠查询性能。用于告知运行时发生的情况及失败原因;若需解决“是否应该启用物化/调整缓存TTL?”这类问题,请使用
endpoint-logs,它会基于配置和diagnosing-endpoint-performance的成本指标进行分析。query_log - 日志为尽力发送。每条运行记录后都会尝试发送日志,但不会阻塞运行——如果用户侧显示运行成功但无日志记录,说明日志发送失败,而非查询执行失败。