Insights never generated on self-hosted: daily job filters on raw `subscriptionStatus = 'active'`
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #598 来自 @grootbro —— 已合并
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- postgresql, typescript
调研方向
从 packages/core/src/modules/insight/src/store.ts 开始,检查 listProjectIdsForCadence,每日作业 insightsDaily 使用它来选择项目。将其订阅筛选条件与 packages/core/src/modules/insight/insight.service.ts 中的每周摘要逻辑进行比较,并检查自托管部署如何处理订阅状态。确认候选查询包含符合条件的自托管项目,同时保留其他筛选条件。
由索引模型根据 Issue 内容生成。
描述
On a self-hosted instance the Insights page always shows "No insights found", for every project. I've been running the server since September and no insights have ever appeared, even on projects with well over 10k events and daily traffic.
Environment
- OpenPanel 3.14.2, self-hosted (Docker),
SELF_HOSTED=true - All worker queues enabled (
ENABLED_QUEUESnot set)
Cause
The insightsDaily cron job picks projects via listProjectIdsForCadence, which filters on the organization's subscription status: https://github.com/Openpanel-dev/openpanel/blob/03e63cd888510c29fdf615c4b9c22a9c7905f2ae/packages/core/src/modules/insight/src/store.ts#L56
On self-hosted this condition is never true:
- Every organization is created with
subscriptionStatus: 'trialing'https://github.com/Openpanel-dev/openpanel/blob/03e63cd888510c29fdf615c4b9c22a9c7905f2ae/packages/core/src/modules/onboarding/onboarding.service.ts#L77 - The
SELF_HOSTEDoverride to'active'is a computed result field https://github.com/Openpanel-dev/openpanel/blob/03e63cd888510c29fdf615c4b9c22a9c7905f2ae/packages/db/src/prisma-client.ts#L48 It only applies on read, not inside awherefilter, so the query matches the raw column value'trialing'.
The weekly digest already handles this. Its comment notes that computed fields can't be used in where, and it filters with { in: ['active', 'trialing'] } https://github.com/Openpanel-dev/openpanel/blob/03e63cd888510c29fdf615c4b9c22a9c7905f2ae/packages/core/src/modules/insight/insight.service.ts#L488 The insights candidate query doesn't.
The same filter is still on main.
Suggested fix
Skip the subscription filter when deps.config.selfHosted is true, or prefilter with { in: ['active', 'trialing'] } and refine with subscriptionState, the same way the weekly digest does.
Workaround
Set the raw column manually in Postgres:
UPDATE organizations
SET "subscriptionStatus" = 'active', "subscriptionEndsAt" = NULL
WHERE id = '<organization id>';
Insights then show up after the next 02:00 UTC run for projects that pass the other filters: more than 10k events and updated within the last 24h.
- 主要语言
- TypeScript
- 星标
- 7.2k
- 派生
- 531
- 平均合并
- 23 小时 58 分钟
- 30 天内合并 PR
- 51
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Openpanel-dev/openpanel 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
Openpanel-dev/openpanel#610 · 1 条评论 ·
维护者通常 1 天内回复
-
ClickHouse retry logs print CLICKHOUSE_URL with its password可能已有人在做 @ppjsw 于 10 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 92/100
Openpanel-dev/openpanel#551 · 1 条评论 ·
维护者通常 1 天内回复
-
login page needs refinement可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
Openpanel-dev/openpanel#495 ·
维护者通常 1 天内回复
-
Dashboard dropdown pickers re-render on every animation frame while open可能已有人在做 @MihirSachdeva 于 1 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 35/100
Openpanel-dev/openpanel#629 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
Openpanel-dev/openpanel#615 ·
维护者通常 1 天内回复
查看 Openpanel-dev/openpanel 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
components-web-app/docs#307 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
localstack/localstack-mcp-server#112 ·
维护者通常 1 天内回复
-
area:frontend kind:bug priority:p1 ready
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 73/100
PhyberApex/kuroshiro#1687 ·
维护者通常 1 天内回复
-
Performance (Web Vitals) collector: LCP/FCP from background tabs are not discarded, inflating p75未关闭
难度 2/5 1-3 小时 新手友好度 74/100
umami-software/umami#4720 ·
维护者通常 3 天内回复