feat(emit): per-metric tier in fused asap_edge agent config (#46 follow-up) - #320
Merged
Merged
Conversation
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>
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
The controller's fused
asap_edgeemit (emit_edge_yaml_asap_edge, gated onASAP_EDGE_FUSED) now stamps a per-metrictier∈ {warm,both,cold} on every entry in the processor'smetrics:list. This is the controller half of the shared contract with the companion ASAPCollectorasapedgeprocessorPR (whoseMetricFamily.Tierfield gates warm-vs-cold per metric; unset defaults toboth).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
EdgeStageConfigthat the fused emit reads, so it generalises to any workload: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).archive_tier_metrics, the plan's archive-routing decision (an exact / archive query forces the Gorilla object-store archive; the same signal the legacygorillas3processor consumed).tier = both(warm+cold),warm(warm only),cold(cold only); defaults tobothwhen no signal is determinable (safe — preserves archival, matching the processor's unset-tier default).Per-metric tier for the MVP workload
http_requests_totalsum by (zone)/rate+ exactcount(http_requests_total{zone="z0"})archive queryhttp_requests_total_latency_msrequest_size_bytesunique_users_per_mintop_endpoint_qpsendpoint_request_freqSo the agent's cold tier archives only what the plan says needs archiving.
Test plan
fused_asap_edge_emits_single_pipeline_and_metrics_listto asserttier: bothfor the archive+warm metric andtier: warmfor all five sketch-only metrics.fused_asap_edge_tier_derives_from_archive_routing— focused derivation test (sketched-only → warm, sketched+archived → both).ASAP_EDGE_FUSEDenv 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_planeclean.cargo test -p control_planeclean (798 tests, 0 failures).🤖 Generated with Claude Code