Skip to content

feat(emit): per-metric tier in fused asap_edge agent config (#46 follow-up) - #320

Merged
zzylol merged 1 commit into
mainfrom
asap-edge-tier-emit
May 25, 2026
Merged

zzylol merged 1 commit into
mainfrom
asap-edge-tier-emit

Conversation

@zzylol

@zzylol zzylol commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

The controller's fused asap_edge emit (emit_edge_yaml_asap_edge, gated on ASAP_EDGE_FUSED) now stamps a per-metric tier ∈ {warm, both, cold} on every entry in the processor's metrics: list. This is the controller half of the shared contract with the companion ASAPCollector asapedgeprocessor PR (whose MetricFamily.Tier field gates warm-vs-cold per metric; unset defaults to both).

Semantics:

  • warm — warm sketch/agg only; NOT cold-archived by the agent.
  • both — warm sketch/agg AND cold gorilla archive.
  • cold — cold gorilla archive only; no warm sketch/agg.

How tier is derived (no hardcoded map)

Derived from the SAME plan routing already on EdgeStageConfig that the fused emit reads, so it generalises to any workload:

  • warm signal — the metric produces a warm entry in this emit: a Sum-by aggregate (cumulative_counter_metrics + metric_to_grouping_labels) or a sketch family (metric_to_family). That is exactly the routing that lands a metric in the warm sketch/agg (sketch_warm_tier).
  • cold signal — the metric is in archive_tier_metrics, the plan's archive-routing decision (an exact / archive query forces the Gorilla object-store archive; the same signal the legacy gorillas3 processor consumed).

tier = both (warm+cold), warm (warm only), cold (cold only); defaults to both when no signal is determinable (safe — preserves archival, matching the processor's unset-tier default).

Per-metric tier for the MVP workload

metric routing tier
http_requests_total warm sum by (zone) / rate + exact count(http_requests_total{zone="z0"}) archive query both
http_requests_total_latency_ms KLL quantile (sketch only) warm
request_size_bytes KLL quantile (sketch only) warm
unique_users_per_min HLL count (sketch only) warm
top_endpoint_qps CountSketch topk (sketch only) warm
endpoint_request_freq CountMinSketch rate (sketch only) warm

So the agent's cold tier archives only what the plan says needs archiving.

Test plan

  • Extended fused_asap_edge_emits_single_pipeline_and_metrics_list to assert tier: both for the archive+warm metric and tier: warm for all five sketch-only metrics.
  • Added fused_asap_edge_tier_derives_from_archive_routing — focused derivation test (sketched-only → warm, sketched+archived → both).
  • Both ASAP_EDGE_FUSED env tests route through the shared env-lock harness (test(control_plane): fix flaky env-var data race in unit tests #318).
  • cargo build -p control_plane clean.
  • cargo test -p control_plane clean (798 tests, 0 failures).

🤖 Generated with Claude Code

Each `metrics[]` entry in the fused `asap_edge` agent config now carries a
`tier` ∈ {warm, both, cold}, derived from the plan routing already on
`EdgeStageConfig` (no hardcoded metric→tier map):

  * warm signal — the metric produces a warm entry (sketch family in
    `metric_to_family` or a Sum-by aggregate).
  * cold signal — the metric is in `archive_tier_metrics` (the plan's
    exact/archive routing decision the legacy gorillas3 path consumed).

tier = both (warm+cold), warm (warm only), cold (cold only), defaulting to
`both` when no signal is determinable (safe — preserves archival, matching
the processor's unset-tier default). This lets the fused agent's cold tier
archive ONLY what the plan says needs archiving (companion to the
ASAPCollector asapedgeprocessor `tier` field).

For the MVP workload: `http_requests_total` (warm sum/rate + exact
`count(...)` archive query) → both; the sketch-only metrics
(`http_requests_total_latency_ms`, `request_size_bytes`,
`unique_users_per_min`, `top_endpoint_qps`, `endpoint_request_freq`) → warm.

Tests: extend the fused emit test to assert tier=both/warm per metric, plus
a focused tier-derivation test; both route `ASAP_EDGE_FUSED` through the
shared env-lock harness (#318).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 03cb113 into main May 25, 2026
@zzylol
zzylol deleted the asap-edge-tier-emit branch July 17, 2026 20:04
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.

1 participant