Skip to content

feat(admin): monitor Snowflake query health#4265

Open
chrarnoldus wants to merge 1 commit into
mainfrom
feat/snowflake-query-monitoring
Open

feat(admin): monitor Snowflake query health#4265
chrarnoldus wants to merge 1 commit into
mainfrom
feat/snowflake-query-monitoring

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • Record every app-side Snowflake logical query with submit, poll, partition, status, retry, rate-limit, latency, and failure metrics without storing SQL or bindings.
  • Add an admin dashboard with rolling aggregate health cards, outcome and latency trends, caller breakdowns, and recent failures.
  • Retain query logs for 30 days through the existing API request log cleanup cron, including a generated database migration.

Verification

  • Manual UI verification was not run because the cloud sandbox has no local Postgres/Docker service available.

Visual Changes

N/A (new admin-only monitoring page; screenshots were not available in the cloud sandbox).

Reviewer Notes

  • KiloClaw billing persists monitoring records through waitUntil so observability does not extend the billing-critical path.
  • Error records retain controlled classifications and bounded Snowflake codes only; SQL text, bindings, and Snowflake error prose are excluded.
  • Focus review on migration 0174_bumpy_stardust, aggregate query cost at higher log volume, and the 30-day retention choice.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus chrarnoldus self-assigned this Jun 25, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (19 files)
  • apps/web/src/app/admin/components/AppSidebar.tsx
  • apps/web/src/app/admin/snowflake-queries/SnowflakeQueryMonitoringContent.tsx
  • apps/web/src/app/admin/snowflake-queries/page.tsx
  • apps/web/src/app/api/cron/cleanup-api-request-log/route.test.ts
  • apps/web/src/app/api/cron/cleanup-api-request-log/route.ts
  • apps/web/src/lib/public-snowflake-report.ts
  • apps/web/src/lib/snowflake-query-log.ts
  • apps/web/src/lib/snowflake.test.ts
  • apps/web/src/lib/snowflake.ts
  • apps/web/src/routers/admin-router.ts
  • apps/web/src/routers/admin/snowflake-query-monitoring-router.test.ts
  • apps/web/src/routers/admin/snowflake-query-monitoring-router.ts
  • apps/web/src/routers/usage-analytics-router.ts
  • packages/db/src/migrations/0174_bumpy_stardust.sql
  • packages/db/src/schema.ts
  • services/kiloclaw-billing/src/index.ts
  • services/kiloclaw-billing/src/lifecycle.ts
  • services/kiloclaw-billing/src/snowflake.test.ts
  • services/kiloclaw-billing/src/snowflake.ts

Reviewed by gpt-5.4-20260305 · Input: 153.4K · Output: 17K · Cached: 1.3M

Review guidance: REVIEW.md from base branch main

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