> ## Documentation Index
> Fetch the complete documentation index at: https://routerdocs.hivenet.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Admission control metrics

> Monitor admission-control occupancy, budgets, concurrency, and request rejections by gate.

The admission-control metrics show why requests are rejected and how close each model is to its configured occupancy and concurrency limits.

## Metrics

| Metric                                       | Type    | Labels            | Meaning                                                                                           |
| -------------------------------------------- | ------- | ----------------- | ------------------------------------------------------------------------------------------------- |
| `hivenet_router_admission_rejections_total`  | Counter | `reason`, `model` | Requests rejected by an admission gate                                                            |
| `hivenet_router_admission_occupancy_tokens`  | Gauge   | `model`           | Current weighted in-flight token sum                                                              |
| `hivenet_router_admission_budget_tokens`     | Gauge   | `model`           | Effective global budget: `HIVENET_ROUTER_ADMIT_FRACTION × admit_budget_tokens × healthy_replicas` |
| `hivenet_router_admission_inflight_requests` | Gauge   | `model`           | Current in-flight request count                                                                   |
| `hivenet_router_admission_max_inflight`      | Gauge   | `model`           | Effective `max_inflight × healthy_replicas`; `0` means no count backstop                          |

The global occupancy controller updates all four gauges when a request is admitted, released, adjusted to exact input usage, or grown by streamed output. The healthy-replica count is recomputed for each admission and floored at `1`, so the budget and backstop gauges follow the live serving pool.

Per-tenant RPM rejects also increment `hivenet_router_tenant_rate_limited_total` in addition to the unified `b4_rpm` reason below.

### Rejection reasons

| `reason`       | Gate and response                                                                |
| -------------- | -------------------------------------------------------------------------------- |
| `b1`           | Per-request input-token or image cap; HTTP `400 input_too_long`                  |
| `b2`           | Global occupancy budget or `max_inflight`; HTTP `429 concurrency_limit_exceeded` |
| `b3`           | Front-door `shed_if` pressure gate; HTTP `429 concurrency_limit_exceeded`        |
| `b4_occupancy` | Serverless per-key occupancy share; HTTP `429 rate_limit_exceeded`               |
| `b4_itpm`      | Serverless per-key input tokens per minute; HTTP `429 rate_limit_exceeded`       |
| `b4_otpm`      | Serverless per-key output tokens per minute; HTTP `429 rate_limit_exceeded`      |
| `b4_rpm`       | Requests per minute; HTTP `429 rate_limit_exceeded`                              |

## PromQL examples

### Occupancy utilization

```promql theme={null}
hivenet_router_admission_occupancy_tokens
  / hivenet_router_admission_budget_tokens
```

Exclude a zero or unset budget when using this expression in an alert:

```promql theme={null}
(
  hivenet_router_admission_occupancy_tokens
    / hivenet_router_admission_budget_tokens
)
and on (model)
hivenet_router_admission_budget_tokens > 0
```

### In-flight concurrency utilization

```promql theme={null}
(
  hivenet_router_admission_inflight_requests
    / hivenet_router_admission_max_inflight
)
and on (model)
hivenet_router_admission_max_inflight > 0
```

### Rejections by gate

```promql theme={null}
sum by (reason, model) (
  rate(hivenet_router_admission_rejections_total[5m])
)
```

### Front-door shed rate

```promql theme={null}
sum by (model) (
  rate(hivenet_router_admission_rejections_total{reason="b3"}[5m])
)
```

### Serverless per-key gate pressure

```promql theme={null}
sum by (reason, model) (
  rate(hivenet_router_admission_rejections_total{reason=~"b4_.*"}[5m])
)
```

The rejection counter has no `tenant_id` or `key_id` label, so it can show that a per-key gate is firing but cannot identify the individual key. Correlate the time window with tenant failure and token-limit metrics or audit records.

## Interpret the signals

* Occupancy near budget with rising `b2` means the model is at its global KV-occupancy limit.
* `b3` rising while occupancy remains below budget means live engine pressure is worse than the token estimate suggests, or the configured shed threshold is deliberately more conservative.
* Sustained `b4_itpm`, `b4_otpm`, or `b4_occupancy` can indicate abusive traffic or undersized serverless key limits.
* A nonzero `max_inflight` with high concurrency utilization can bind before the token budget does when requests are small.

See [Admission control](/routing/admission-control) for gate order, reservation behavior, and client-facing errors.
