Skip to content

feat(insights): runtime kill switch for the shared insight database - #88716

Merged
aspicer merged 1 commit into
aspicer/hogql-shared-database-trendsfrom
aspicer/hogql-shared-database-killswitch
Aug 25, 2026
Merged

aspicer merged 1 commit into
aspicer/hogql-shared-database-trendsfrom
aspicer/hogql-shared-database-killswitch

Conversation

@aspicer

@aspicer aspicer commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

#88183 shares one HogQL database across an insight run's query threads. If the sharing misbehaves in production, the only rollback is a revert and a redeploy.

Changes

  • Staff can turn the sharing off at runtime: instance setting HOGQL_SHARED_INSIGHT_DATABASE_ENABLED, default on, editable via the instance settings API. Workers pick up a change within 60 seconds.
  • Off means shared_database returns a fresh database per access, so query threads never share schema state. Every wired runner falls back to per-call builds, the pre-perf(insights): build the hogql database once per insight run #88183 threading profile.
  • The off path records no timing because concurrent threads reach it and HogQLTimings is not thread-safe.

How did you test this code?

test_shared_database_kill_switch_disables_sharing: with the setting off, two property accesses return different instances; back on, the same instance. Catches a refactor that silently drops the switch and with it the emergency lever.

Automatic notifications

  • Publish to changelog?

Docs update

None. Staff-only instance setting.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Built with Claude Code as a decision aid layered on #88183: the assignee will judge whether the runtime switch earns its complexity, then fold this into the base PR or close it. Skills invoked: /writing-tests, /writing-code-comments, /writing-pr-descriptions.

@aspicer aspicer self-assigned this Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@trunk-io

trunk-io Bot commented Aug 25, 2026

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@aspicer
aspicer merged commit ac5568d into aspicer/hogql-shared-database-trends Aug 25, 2026
190 checks passed
@aspicer
aspicer deleted the aspicer/hogql-shared-database-killswitch branch August 25, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant