Repository navigation
fix(asap-tools): probe the ClickHouse adapter's readiness endpoint #905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,14 @@ def get_http_port(self) -> int: | |
| return 8088 | ||
|
|
||
|
|
||
| def runtime_info_endpoint(backend_type: str) -> str: | ||
| """The readiness endpoint of the engine's query adapter for `backend_type`: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Altitude: this duplicates |
||
| the ClickHouse adapter serves no Prometheus API.""" | ||
| if backend_type == "clickhouse": | ||
| return constants.QUERY_ENGINE_CLICKHOUSE_RUNTIME_INFO_ENDPOINT | ||
| return constants.QUERY_ENGINE_RUNTIME_INFO_ENDPOINT | ||
|
|
||
|
|
||
| class QueryEngineRustService(BaseQueryEngineService): | ||
| """Service for managing the Rust query engine process.""" | ||
|
|
||
|
|
@@ -100,6 +108,8 @@ def __init__( | |
| self.remote_spill_dir: Optional[str] = None | ||
| self.local_spill_report: Optional[str] = None | ||
| self.http_port: Optional[int] = None | ||
| # The started backend's adapter's; set by start(). | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the attribute |
||
| self.runtime_info_endpoint = constants.QUERY_ENGINE_RUNTIME_INFO_ENDPOINT | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Config-file helpers (used by both bare-metal and containerized paths) | ||
|
|
@@ -272,6 +282,7 @@ def start( | |
| remote_write_port: Port the precompute engine listens on for Prometheus remote | ||
| write; should match streaming.remote_write.base_port (default 8080) | ||
| """ | ||
| self.runtime_info_endpoint = runtime_info_endpoint(backend_config["type"]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: |
||
| if spill: | ||
| self.remote_spill_dir = os.path.join( | ||
| experiment_output_dir, "query_engine_output", SPILL_SUBDIR | ||
|
|
@@ -652,7 +663,7 @@ def _is_runtime_info_ready(self) -> bool: | |
| cmd = ( | ||
| f"curl -fsS --max-time {constants.HTTP_READINESS_CURL_TIMEOUT_SECONDS} " | ||
| f"http://127.0.0.1:{self.get_http_port()}" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The probe uses |
||
| f"{constants.QUERY_ENGINE_RUNTIME_INFO_ENDPOINT} >/dev/null" | ||
| f"{self.runtime_info_endpoint} >/dev/null" | ||
| ) | ||
| result = self.provider.execute_command( | ||
| node_idx=self.node_offset, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ | |
| from constants import BASELINE_EXPERIMENT_NAME, SKETCHDB_EXPERIMENT_NAME | ||
| from experiment_utils.services.base import DockerServiceBase | ||
| from experiment_utils.services.docker_victoriametrics import get_remote_write_urls | ||
| from experiment_utils.services.query_engine import QueryEngineRustService | ||
| from experiment_utils.services.query_engine import ( | ||
| QueryEngineRustService, | ||
| runtime_info_endpoint, | ||
| ) | ||
|
|
||
|
|
||
| class RemoteWriteConfigurationTest(unittest.TestCase): | ||
|
|
@@ -84,6 +87,24 @@ def test_query_engine_requires_runtime_info_endpoint(self): | |
| provider.execute_command.call_args_list[1].kwargs["cmd"], | ||
| ) | ||
|
|
||
| def test_clickhouse_backed_query_engine_probes_its_adapters_endpoint(self): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: a ClickHouse query-engine readiness test lives in |
||
| # It serves /clickhouse/ping and 404s on the Prometheus runtime-info | ||
| # path, so probing that one never saw it ready. | ||
| provider = Mock() | ||
| provider.execute_command.return_value = subprocess.CompletedProcess( | ||
| args="curl", returncode=0, stdout="", stderr="" | ||
| ) | ||
| service = QueryEngineRustService(provider, use_container=False, node_offset=0) | ||
| service.runtime_info_endpoint = runtime_info_endpoint("clickhouse") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sets |
||
|
|
||
| self.assertTrue(service._is_runtime_info_ready()) | ||
| self.assertIn( | ||
| "/clickhouse/ping", provider.execute_command.call_args.kwargs["cmd"] | ||
| ) | ||
| self.assertEqual( | ||
| runtime_info_endpoint("prometheus"), "/api/v1/status/runtimeinfo" | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runtime_info_endpoint()maps only"clickhouse"; every other backend falls through to the Prometheus path.elastic_querydsl/elastic_sqluseElasticHttpAdapter, which only routes runtime info at/_cluster/health(elastic_http.rs:232), so the probe 404s andwait_until_readystill times out after 60 s — the same failure this PR fixes for ClickHouse.