Skip to content

Add instanceId to pool metrics for per-instance deduplication#526

Merged
iscekic merged 1 commit intomainfrom
igor/db-observability-and-timeout
Feb 24, 2026
Merged

Add instanceId to pool metrics for per-instance deduplication#526
iscekic merged 1 commit intomainfrom
igor/db-observability-and-timeout

Conversation

@iscekic
Copy link
Contributor

@iscekic iscekic commented Feb 24, 2026

Summary

Adds a stable instanceId field to the pool metrics JSON logged every 30s (from #520). Without this, Axiom dashboard queries can't distinguish readings from different Vercel function instances, making it impossible to accurately compute global connection totals (sum across instances) vs per-instance stats.

The instanceId is generated once at module load as {region}-{timestamp}-{random}, e.g. iad1-1771954564449-k3x9f2. It's stable for the lifetime of the function instance.

Updated Axiom dashboard queries

With instanceId, the dashboard charts should use this pattern to get accurate global totals:

| summarize latest_total=arg_max(_time, total) by instanceId, bin(_time, 1m)
| summarize sum(latest_total) by bin(_time, 1m)

Changes

  • src/lib/drizzle.ts — add instanceId field to pool metrics log output

@iscekic iscekic self-assigned this Feb 24, 2026
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 24, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/lib/drizzle.ts — Added instanceId (region + timestamp + random suffix) to pool metrics logging for per-instance deduplication in Axiom. Clean, minimal change with no security, correctness, or performance concerns.

@iscekic iscekic enabled auto-merge February 24, 2026 18:49
@iscekic iscekic merged commit 7b674aa into main Feb 24, 2026
12 checks passed
@iscekic iscekic deleted the igor/db-observability-and-timeout branch February 24, 2026 18:54
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.

2 participants