api7 / api7/aisix

guardrail metrics: a distinct fail-closed counter (error-block vs policy-block)

Open
#520 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.