api7 / api7/aisix

Attribute guardrail blocks in telemetry for /v1/responses and /v1/embeddings (Blocked tab under-counts)

Open
#543 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority-normal
Dominant language
Rust
Stars
157
Forks
32
Avg merge
1h 25m
Merged PRs (30d)
145

Description

Summary

/v1/chat/completions threads applied_guardrails and sets guardrail_blocked=true on the UsageEvent so the dashboard's Blocked tab reflects guardrail blocks. /v1/responses and /v1/embeddings (input guardrails added in #541) emit only a generic zero-token error event (error_class=content_filter) on a block — no guardrail_blocked flag and no applied_guardrails set.

Impact

Low (observability only): the dashboard Blocked tab and applied-guardrail analytics under-count guardrail blocks on the non-chat surfaces. The embeddings handler already documents that bypass-telemetry plumbing for non-chat handlers is deferred.

Fix

Thread applied_guardrails + a guardrail_blocked signal through the responses/embeddings dispatch return + emit paths, mirroring chat.rs.

Surfaced by the independent audit of #541. Refs #719.

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 with chat.rs to trace how applied_guardrails and guardrail_blocked reach UsageEvent, then follow the /v1/responses and /v1/embeddings dispatch return and emit paths. Confirm how input-guardrail blocks currently produce the zero-token content_filter event. Done means both non-chat surfaces record the applied guardrails and guardrail_blocked signal so the dashboard Blocked tab and guardrail analytics include those blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.