Skip to content
Merged
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: 5 additions & 1 deletion asap-query-engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ struct Args {
/// can generate a new sketch plan. When unset (default),
/// capability misses fall through to the §5.2 fallback silently.
/// Example: `http://controller.svc:8080/api/v1/plan`
#[arg(long)]
///
/// Falls back to the `ASAP_CONTROLLER_URL` env var when the flag
/// is not passed — `deploy/docker-compose/base.yml` sets the env
/// var so the MVP demo doesn't need a per-arg overlay.
#[arg(long, env = "ASAP_CONTROLLER_URL")]
controller_endpoint: Option<String>,

/// Wire protocol for `--controller-endpoint`. `generic` (default)
Expand Down
14 changes: 8 additions & 6 deletions asap-query-engine/src/routing/freshness_probe_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,20 @@ use std::collections::HashMap;
use std::sync::RwLock;
use std::time::{SystemTime, UNIX_EPOCH};

/// Metric-name prefix the cache filters on. Only metrics whose
/// name starts with this string are captured. Matches the three
/// probe metric names emitted by `deploy/fake-exporter/probes.go`
/// (`http_freshness_probe_raw` / `_warm` / `_archive`).
const PROBE_NAME_PREFIX: &str = "http_freshness_probe_";
/// Substring the cache filters on. Any metric name containing this
/// token (with the trailing underscore to keep the tier suffix
/// disambiguated) is captured. The MVP fake-exporter emits three
/// probes named `http_freshness_probe_{raw,warm,archive}`; user-
/// extensible probes (e.g. `latency_freshness_probe_*`) are matched
/// without a code change.
const PROBE_NAME_TOKEN: &str = "freshness_probe_";

/// Returns `true` iff the metric name belongs to the freshness-probe
/// family — used by both the ingest write path (filter before
/// storing) and the query read path (intercept before normal
/// routing).
pub fn is_freshness_probe(metric: &str) -> bool {
metric.starts_with(PROBE_NAME_PREFIX)
metric.contains(PROBE_NAME_TOKEN)
}

/// One cached entry: the most-recent `(timestamp, value)` for a
Expand Down