mvp phase ε.2: register prometheus_remote engine in EngineRouter - #103
Merged
Merged
Conversation
Adds a `PrometheusForwardEngine` (HTTP-forwarder to Prometheus's `/api/v1/query`) under the `prometheus_remote` engine id so the controller's Mode 3 (`RawAtEdgePrometheusArchive`) routing entries have a dispatchable target on the backend. Mirror of Step-2.3's `ThanosForwardEngine` (PR #97), pointed at Prometheus's standard HTTP API instead of a thanos-query sidecar. Wiring is conditional on `ASAP_PROMETHEUS_QUERY_URL`: when set, the binary registers the engine on the capability router (both `main.rs` and `bin/precompute_engine.rs`); when unset, the engine is not registered and a routing-table entry that references `prometheus_remote` surfaces a clean `NoEngineRegistered` 503 from the HTTP handler — the correct fail-loud behaviour for a misconfigured deploy. Phase ε.1 (controller, separate repo) emits `engine: prometheus_remote` in the `BackendStorageRouting` JSON; this PR closes the loop by accepting that string in `parse_engine_string` and resolving it to the new `StorageBackend::PrometheusRemote` variant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PrometheusForwardEngine(HTTP-forwarder to Prometheus's standard/api/v1/query) and registers it on the capability router underdata_source_id = prometheus_remotewhenASAP_PROMETHEUS_QUERY_URLis set. Wired into bothsrc/main.rsandsrc/bin/precompute_engine.rs. Mirror of Step-2.3'sThanosForwardEngine(PR mvp step 2.3: backend HTTP-forward to thanos-query for Path A2 archive #97), pointed at Prometheus instead of a thanos-query sidecar.StorageBackend::PrometheusRemote(data_source_id = "prometheus_remote") toasap_types::capability_matchingsocompatible_storage_backendsreturns[PrometheusRemote]for Mode 3 metrics (single backend, no failover — the metric's data never landed in ASAP-managed storage).parse_engine_stringinBackendStorageRoutingaccepts the controller'sengine: prometheus_remotestring.prometheus_remotereturnsNoEngineRegistered. Engine reachable but Prometheus down →Backend(prometheus_unreachable: ...)→ 503 withdata_source_quirk: prometheus_unreachablein the response infos.Context
Phase ε.1 (controller, separate repo) emits
engine: prometheus_remotein theBackendStorageRoutingJSON for metrics whose raw data is shipped to Prometheus's native OTLP receiver (controller'sRawAtEdgePrometheusArchivemode). Phase ε.2 (this PR) closes the loop by registering an engine that handles those routing entries. Existingthanos_archive/gorilla_archiveregistrations are unchanged.Test plan
cargo build --release— greencargo test --release --lib— 33 pre-existing backend failures unchanged; +17 new tests (12 inengines::prometheus::forward::tests, 3 inrouting::backend_storage_routing::tests, 2 inrouting::engine_router::tests) all passengine: prometheus_remoteparses toStorageBackend::PrometheusRemoteStorageBackend::PrometheusRemoteto the registered engine; missing-engine surfacesNoEngineRegistered🤖 Generated with Claude Code