Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deployments/PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ ROUTES — top 3 by total
requests are being rejected before any DB work — usually unauthenticated load
(see the auth note in Step 2).

> **Statement truncation.** Query statements are normalized and truncated to a
> fixed prefix (2000 chars) before logging, so queries that differ only past the
> cutoff — large `IN (...)` lists, big CTEs — collapse into a single row in the
> `QUERIES` report. If a row's `count` looks suspiciously high or its statement
> ends in `…`, it may be several distinct queries merged together.
Comment thread
AlexAxthelm marked this conversation as resolved.

---

## Comparing variants (data volume / params)
Expand Down
4 changes: 4 additions & 0 deletions deployments/api/src/stitch/api/observability/query_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@


def _normalize_statement(statement: str, max_chars: int) -> str:
# NB: statements longer than max_chars are truncated to a shared prefix, so
# queries that differ only past the cutoff (large IN (...) lists, big CTEs)
# collapse into one group in the analyzer. Acceptable tradeoff; documented in
# deployments/PERFORMANCE.md so users aren't surprised by merged rows.
collapsed = _WHITESPACE.sub(" ", statement).strip()
if len(collapsed) > max_chars:
return collapsed[:max_chars] + "…"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
command: ["alembic", "-c", "deployments/api/alembic.ini", "revision", "--autogenerate", "-m", "baseline"]
# On-demand only (via `make alembic-autogenerate`). Must NOT be in the
# `tools`/`full` profiles, or it autogenerates a blank revision on every
# `make api-dev` / `reboot-docker` startup.
# `make api-dev` / `make reboot-docker` startup.
profiles: ["alembic-generate"]
restart: "no"

Expand Down
Loading