fix(metrics): preserve runtime limit rejection labels
CI / UI Checks (pull_request) Successful in 12s
CI / Rust Checks (pull_request) Successful in 38m11s
CI / Rust Feature Validation (pull_request) Failing after 10s
CI / Frontend E2E (pull_request) Failing after 25m28s
CI / Community Image Smoke (pull_request) Failing after 27m22s
CI / Required Checks (pull_request) Failing after 1s
CI / Deploy (pull_request) Skipped

This commit is contained in:
Codex (teamlead-profile) committed 2026-12-05 19:25:05 +00:00
1 parent 2fa5b9de67
commit c31a0e8e5c
8 files changed
+92 -43

No files matched your search

+3 -3
View File
@@ -217,13 +217,13 @@ string_enum! {
Concurrency => "concurrency",
RateLimit => "rate_limit",
McpStream => "mcp_stream",
Admission => "admission",
}
}
string_enum! {
pub enum RejectionReason {
Limit => "limit",
Capacity => "capacity",
QueueFull => "queue_full",
Deadline => "deadline",
@@ -234,7 +234,7 @@ string_enum! {
string_enum! {
pub enum ScopeKind {
Process => "process",
Global => "global",
Agent => "agent",
Tool => "tool",
+4 -10
View File
@@ -350,24 +350,18 @@ pub fn record_limit_rejection(stage: LimitStage) {
if bound_family("crank_runtime_limit_rejections_total").is_none() {
return;
}
metrics::counter!(
"crank_runtime_limit_rejections_total",
"stage" => stage.as_str(),
"reason" => RejectionReason::Limit.as_str(),
"scope_kind" => ScopeKind::Process.as_str()
)
.increment(1);
metrics::counter!("crank_runtime_limit_rejections_total", "stage" => stage.as_str())
.increment(1);
}
/// Typed admission refusal with finite, low-cardinality labels only: no workspace, Agent, Tool,
/// request id, fingerprint or arbitrary error text ever becomes a label.
pub fn record_admission_rejection(reason: RejectionReason, scope_kind: ScopeKind) {
if bound_family("crank_runtime_limit_rejections_total").is_none() {
if bound_family("crank_runtime_admission_rejections_total").is_none() {
return;
}
metrics::counter!(
"crank_runtime_limit_rejections_total",
"stage" => LimitStage::Admission.as_str(),
"crank_runtime_admission_rejections_total",
"reason" => reason.as_str(),
"scope_kind" => scope_kind.as_str()
)
+14 -4
View File
@@ -407,16 +407,26 @@ pub(crate) const METRIC_SCHEMA: &[MetricDefinition] = &[
"crank_runtime_limit_rejections_total",
MetricKind::Counter,
MetricUnit::Count,
&["stage", "reason", "scope_kind"],
&["stage"],
&[domain("stage", LIMIT_STAGES)],
&[],
BOTH,
3,
"Runtime executions rejected by a bounded limit.",
),
metric(
"crank_runtime_admission_rejections_total",
MetricKind::Counter,
MetricUnit::Count,
&["reason", "scope_kind"],
&[
domain("stage", LIMIT_STAGES),
domain("reason", REJECTION_REASONS),
domain("scope_kind", SCOPE_KINDS),
],
&[],
BOTH,
96,
"Runtime executions rejected by a bounded limit.",
15,
"Runtime executions rejected by scoped admission.",
),
metric(
"crank_runtime_admission_queue_wait_seconds",