Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limit
维护者通常 2 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend, observability
调研方向
先从 packages/api/src/tasks/checkAlerts/transports/slack.ts 开始,检查 section 块如何组合链接、标题和正文;然后阅读 packages/api/src/tasks/checkAlerts/template.ts,追踪内联告警链接的构建方式。使用较长的内联告警链接重现故障,并检查现有的 Slack transport 测试。完成标准是 Slack 接受超长的内联告警通知,同时较短的告警链接仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Summary
Slack notifications for inline alerts fail when the alert's chart config is large. The alert does fire, but HyperDX records WEBHOOK_ERROR: Failed to send notification to webhook "<name>" and nothing reaches Slack. The same alert set up as a tile alert posts fine.
Cause
For an inline alert, buildAlertMessageTemplateHdxLink (packages/api/src/tasks/checkAlerts/template.ts) links to the chart explorer with the alert's whole chartConfig URL-encoded in the query string (buildChartExplorerLink). Saved-search and tile alerts link to /search/<id> or the dashboard, which are short.
The Slack transport (packages/api/src/tasks/checkAlerts/transports/slack.ts) puts the link, the title and the body into a single section block:
blocks: [{ type: 'section', text: { type: 'mrkdwn', text: `*<${message.hdxLink} | ${message.title}>*\n${message.body}` } }]
Slack limits a section block's text to 3000 characters, and the URL counts toward that limit even though Slack only shows the title. So once the encoded config, the title and the body pass 3000 characters, Slack rejects the message.
Example (HyperDX 2.39.1)
An inline builder alert on a metrics source with 8 histogram series (quantile p99, one metricName each):
- Each series becomes about 280 characters of the link, because the stored config adds
aggCondition,aggConditionLanguage,isDeltaand similar fields and URL encoding roughly multiplies JSON by 1.4. - With series aliases, a descriptive name and display settings (
numberFormat,fitYAxisToData), the link was about 3100 characters. Every notification failed withWEBHOOK_ERROR. - After removing the aliases, display settings and most of the name, the link was about 2580 characters and the notification posted.
- A raw SQL inline alert with about 1700 characters of SQL produces a link of about 2500 characters and is right at the edge.
So a perfectly ordinary alert silently loses its notifications. The only sign is an executionErrors entry on the alert.
Suggestions
Any of these would fix it:
- Link inline alerts to something short, for example the alert itself (an alerts page or anchor by alert id), or a server-side stored chart that opens by id, instead of encoding the whole config in the URL.
- In the Slack transport, if the section text would pass 3000 characters, fall back to a shorter link (the alerts page) or put the link in a separate block or button. A button
urlallows up to 3000 characters on its own. - At minimum, warn when saving an inline alert whose notification link would exceed the Slack limit, and say in the
WEBHOOK_ERRORthat the message was too long.
Environment
- HyperDX 2.39.1 (ClickStack Helm chart 3.4.0), Slack incoming webhook
- Alert source: inline (created through the MCP
clickstack_save_alerttool / external API)
- 主要语言
- TypeScript
- 星标
- 10k
- 派生
- 501
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 148
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hyperdxio/hyperdx 的其他 Issue
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several arguments可能已有人在做 @CG-5228 于 3 天前认领。 未关闭external
难度 2/5 1-3 小时 新手友好度 76/100
hyperdxio/hyperdx#3477 · 1 条评论 ·
维护者通常 2 天内回复
-
external
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
bug external Needs Feedback
难度 2/5 1-3 小时 新手友好度 72/100
hyperdxio/hyperdx#3308 · 1 条评论 ·
维护者通常 2 天内回复
-
external
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
查看 hyperdxio/hyperdx 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
lichess-org/lila#22324 · 1 条评论 ·
维护者通常 1 天内回复
-
ep:WebGPU platform:web quantization
难度 2/5 1-3 小时 新手友好度 66/100
microsoft/onnxruntime#33752 ·
维护者通常 2 天内回复
-
[Skill Bug]: entra-agent-id: inaccurate blueprint permission inheritance and parent token sub claim未关闭bug entra-agent-id
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/GitHub-Copilot-for-Azure#3467 · 1 条评论 ·
维护者通常 1 天内回复
-
fix(worker): keep normal prepare waiting states failure-free可能已有人在做 @LichKing-2234 今天认领。 未关闭agent:codex priority:P1
难度 2/5 1-3 小时 新手友好度 72/100
AgoraIO-Extensions/agent-infra#3745 ·
维护者通常 1 天内回复
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framing可能已有人在做 @Eapp1e 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
makecindy/cindy#7973 · 1 条评论 ·
维护者通常 1 天内回复