Skip to content

fix(asap-tools): let long-window baseline queries finish - #861

Merged
milindsrivastava1997 merged 2 commits into
mainfrom
fix/e2e-baseline-query-timeouts
Oct 14, 2026
Merged

milindsrivastava1997 merged 2 commits into
mainfrom
fix/e2e-baseline-query-timeouts

Conversation

@zzylol

@zzylol zzylol commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Summary

The end-to-end evaluation runs 6h and 24h windows on the baselines, and those queries can take minutes. Three timeouts in the current setup would cut them off, and nothing in the experiments framework overrides them:

System Timeout today Change
Prometheus (bare metal and container) server --query.timeout, default 2 min --query.timeout=24h (PROMETHEUS_QUERY_TIMEOUT in constants.py)
VictoriaMetrics (vmsingle) -search.maxQueryDuration 30 s, -search.maxQueueDuration 10 s both 24h
ClickHouse query client requests timeout 30 s None: wait for the query

VictoriaMetrics' -retentionPeriod also goes from 1d to 3d, so a 24 h window plus the run stays on disk.

The Prometheus query client itself sets no timeout on queries (its 10 s is only the runtimeinfo status call), and ASAPQuery's endpoint isn't changed.

Testing

  • Prometheus 2.53.0 started with the flag reports query.timeout: 1d in /api/v1/status/flags.
  • The VictoriaMetrics compose template renders the new flags.
  • ClickHouseQueryClient(...).timeout is None.
  • The experiments suite passes (64 tests); black and flake8 are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AnJ7LocWxguh3q4QWkCYae

Prometheus cancels a query after 2 minutes, VictoriaMetrics after 30 s
(plus 10 s in its queue), and the ClickHouse query client gave up after
30 s. The e2e baselines run 6h and 24h windows that take minutes, so raise
Prometheus' --query.timeout and VictoriaMetrics' search limits to 24h and
let the ClickHouse client wait. VictoriaMetrics' retention goes from 1d to
3d so a 24 h window plus the run stays on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnJ7LocWxguh3q4QWkCYae
timeout: int = 30,
# None waits for the query to finish; long-window baseline queries
# can take minutes.
timeout: Optional[float] = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeout=None also disables the connect timeout, so a stalled/unreachable ClickHouse (OOM, silent TCP drop) blocks session.post forever and the prometheus-client container never exits. Suggest a (connect, read) tuple, e.g. (10, 86400): long queries still finish, dead connections still fail. (The Timeout handler's message would then also stop printing None.)

cmd = f"./prometheus --config.file={PROMETHEUS_CONFIG_FILE} > /dev/null 2>&1 < /dev/null &"
cmd = (
f"./prometheus --config.file={PROMETHEUS_CONFIG_FILE}"
f" --query.timeout={PROMETHEUS_QUERY_TIMEOUT}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raising --query.timeout alone may not be enough: Prometheus also caps --query.max-samples (default 50M). A 24h *_over_time over many series can exceed it and fail immediately with "query processing would load too many samples into memory", regardless of the timeout. Same applies to docker_prometheus.py.

# Keep a 24 h window plus the run, and let long-window queries finish
# (the defaults are 30 s per query and 10 s waiting in the queue).
- "-retentionPeriod=3d"
- "-search.maxQueryDuration=24h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, VictoriaMetrics has per-query limits besides duration: -search.maxPointsPerTimeseries (default 30000), -search.maxSamplesPerSeries, -search.maxSamplesPerQuery, -search.maxUniqueTimeseries. Long-window/many-series queries can be rejected with a limit-exceeded error, so the 6h/24h baselines could still fail.

- Prometheus: pass --query.max-samples so 24h windows aren't rejected.
- VictoriaMetrics: raise maxSamplesPerQuery and maxPointsPerTimeseries.
- ClickHouse client: (connect, read) timeout so a dead server fails
  instead of hanging the querier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 merged commit bd49b0a into main Oct 14, 2026
15 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the fix/e2e-baseline-query-timeouts branch October 14, 2026 14:23
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