guardrail metrics: a distinct fail-closed counter (error-block vs policy-block)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 157
- Forks
- 32
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 145
Description
aisix_guardrail_blocks_total counts ALL guardrail blocks — both policy blocks (content matched) and fail-closed blocks (a remote-API guardrail's upstream errored and fail_open=false → block). These are not distinguished today: both surface as GuardrailVerdict::Block at the handler, and the verdict carries no error-vs-policy category.
A dedicated aisix_guardrail_fail_close_total (alertable: "guardrails are failing closed because a provider is down") needs the guardrail to signal when a Block is due to an upstream error rather than policy. Options: a structured field on the Block verdict, or the guardrail impls (bedrock/azure/aliyun) recording the fail-closed event themselves (would couple aisix-guardrails to aisix-obs). The fail-OPEN counterpart is already covered by aisix_guardrail_bypasses_total{reason}.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing GuardrailVerdict::Block through the handler and reviewing the bedrock, azure, and aliyun guardrail implementations. Determine how to distinguish upstream-error fail-closed blocks from policy blocks and how the existing aisix_guardrail_blocks_total and aisix_guardrail_bypasses_total metrics are recorded. Done means fail-closed events expose a distinct alertable counter without conflating policy blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, azure, rust
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100