log list/view --fields breaks on typed custom attributes
维护者通常 1 天内回复
@BYK 已经在做这个了。
开始于 2026年9月9日。
评估
这个 Issue 还没有评估数据。
描述
What happened
sentry log list / log view --fields supports requesting log attributes beyond the small set of fixed schema columns (timestamp, message, severity, trace, etc.). Those fixed columns resolve by plain name, but Sentry's logs backend requires custom/dynamic attributes to be requested with a type-qualified selector, tags[<name>,<type>] (e.g. tags[shard_id,number]) — because the same attribute name can be ingested as a different type across different log calls, so the query engine needs to know which typed column to read. Verified directly against the API: field=shard_id (plain) returns "shard_id": null, while field=tags[shard_id,number] returns the real value.
The bug: --fields is parsed by parseFieldsList() (packages/cli/src/lib/formatters/json.ts), which unconditionally splits the whole flag value on every comma. tags[shard_id,number] has a comma inside the attribute name, so requesting it shreds one valid field into two garbage fragments — tags[shard_id and number] — before it ever reaches the API. There is no escaping mechanism, and --fields cannot be repeated (a second --fields flag errors with "Too many arguments for --fields"), so there is currently no way to request a typed custom attribute through log list/log view --fields at all.
Why this is confusing in practice
sentry log list org/project --fields shard_id,num_shards looks like a normal, well-formed request and returns valid JSON — just with null for every custom field, with no error and no hint that these are custom attributes requiring the tags[name,type] form. Switching to the documented type-qualified syntax then hits a second, different-looking wall: --fields 'tags[shard_id,number]' still returns null, but now split into two malformed keys ({"tags[shard_id": null, "number]": null}). That looks like the type-qualified syntax itself isn't supported by these commands, when actually the comma inside it is being torn apart by the flag parser before the request is even built.
Root cause
parseFieldsList() in packages/cli/src/lib/formatters/json.ts does an unconditional .split(",") on the raw --fields string, with no awareness of the tags[name,type] bracket syntax used for custom log/span attributes elsewhere in the CLI. (sentry api -F 'field=tags[shard_id,number]' works correctly, because api.ts's field parsing doesn't have this issue — it's specific to the shared --fields flag parser used by log, trace, and span commands.) Any --fields value containing a bracketed, comma-containing attribute name breaks before it reaches the log/trace/span API layer.
Proposed fixes
- Make
parseFieldsList()bracket-aware: only split on top-level commas, treating[...]spans as atomic (a small tokenizer, or a regex that ignores commas inside brackets). - Alternatively/additionally, support repeating
--fields(currently rejected) so multi-value selection doesn't depend on the flag's own comma-splitting. - Document the
tags[name,type]syntax directly inlog list --help/log view --help— today it's only discoverable viasentry api --help.
via lorenzo.
--
- 主要语言
- TypeScript
- 星标
- 938
- 派生
- 166
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 156
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/toolkit 的其他 Issue
-
bug MCP
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/toolkit#1600 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
getsentry/toolkit#1471 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
getsentry/toolkit#1611 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement MCP
难度 4/5 1-2 天 新手友好度 55/100
getsentry/toolkit#1601 · 1 条评论 ·
维护者通常 1 天内回复
-
Use typed detector schemas from @sentry/api for metric monitors可能已有人在做 @MathurAditya724 于 1 天前认领。 未关闭
getsentry/toolkit#1595 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 getsentry/toolkit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
维护者通常 1 天内回复
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)可能已有人在做 @illya-havsiyevych 今天认领。 未关闭bug
难度 1/5 1-3 小时 新手友好度 87/100
epam/ai-dial-chat#9566 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
はさみアイコンを修正する未关闭bug
难度 1/5 1 小时以内 新手友好度 68/100
-
area: core
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复