Skip to content

fix(weave): classify ClickHouse TOO_SLOW as QueryEstimatedTimeoutExceededError - #7607

Merged
mscavezze-cw merged 1 commit into
masterfrom
mike/trace-server-map-clickhouse-too-slow
Jul 23, 2026
Merged

fix(weave): classify ClickHouse TOO_SLOW as QueryEstimatedTimeoutExceededError#7607
mscavezze-cw merged 1 commit into
masterfrom
mike/trace-server-map-clickhouse-too-slow

Conversation

@mscavezze-cw

@mscavezze-cw mscavezze-cw commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

JIRA Issue(s)

WB-37836

Description

TOO_SLOW currently shows up as (Unexpected error - investigate!) in our alerts (recent example). This raises unnecessary concern for a known-issue and creates alert fatigue. I'm adding a new error type that we can filter on, so we can have cleaner alerts. I'm keeping this distinct from QueryTimeoutExceededError, so that we can differentiate between timeouts and predicted timeouts.

Testing

How did you test your PR? What is the blast radius of your change? Provide a test plan.

  • Unit tests

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ededError

ClickHouse rejects an over-broad query up front with error code 160
(TOO_SLOW) when its *estimated* execution time exceeds
max_estimated_execution_time -- the planner declines to run it rather
than timing out mid-flight. handle_clickhouse_query_error() had no
branch for this, so it fell through to the generic clickhouse_connect
DatabaseError and was surfaced as a 502 "Temporary backend error".

That is a benign, self-inflicted user-query rejection (the same class of
query-too-heavy guard as TIMEOUT_EXCEEDED), but the misclassification
meant it read as an unexpected server fault: it returned an opaque 5xx
to the customer instead of actionable "limit the scope" guidance, and it
tripped the paging monitor for unexpected weave-trace 5xx
(DD 19065158 / WB-33068).

Add a dedicated QueryEstimatedTimeoutExceededError (504) and map TOO_SLOW
to it. It is kept distinct from QueryTimeoutExceededError -- a query that
actually ran and timed out mid-flight -- so the pre-execution rejection
is identifiable on its own in tracing and alerting.

NOTE: because this is a new error type, monitor 19065158 (which excludes
error.type:QueryTimeoutExceededError) must also exclude
error.type:QueryEstimatedTimeoutExceededError to stay quiet on these
customer-driven query rejections.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mscavezze-cw
mscavezze-cw force-pushed the mike/trace-server-map-clickhouse-too-slow branch from b66cbfa to 6bb633f Compare July 22, 2026 21:52
@mscavezze-cw mscavezze-cw changed the title fix(weave): map ClickHouse TOO_SLOW (code 160) to a query-timeout error fix(weave): classify ClickHouse TOO_SLOW as QueryEstimatedTimeoutExceededError Jul 22, 2026
@mscavezze-cw
mscavezze-cw marked this pull request as ready for review July 22, 2026 22:58
@mscavezze-cw
mscavezze-cw requested a review from a team as a code owner July 22, 2026 22:58
@mscavezze-cw
mscavezze-cw merged commit bfd99d5 into master Jul 23, 2026
112 checks passed
@mscavezze-cw
mscavezze-cw deleted the mike/trace-server-map-clickhouse-too-slow branch July 23, 2026 00:24
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants