Skip to content

Failed requests emit no usage events on completions/embeddings/rerank/images/audio #748

Description

@jarvis9443

Split out of the AISIX-Cloud#1013 work (failed-request content capture, PR pending).

The three routing endpoints (chat / messages / responses) emit per-attempt + terminal UsageEvents on failure (#655), and now also carry the captured request body. The remaining five handlers are success-only emitters: a failed /v1/embeddings, /v1/completions, /v1/rerank, /v1/images or /v1/audio request produces no usage event at all — no SLS record, no dashboard Logs row, with or without content. E.g. embeddings.rs documents it outright: "guardrail_blocked — a blocked input short-circuits before this emit (success-only path)", and completions.rs only emits inside if let Some(usage) on the Ok arm.

Scope: give these five handlers failure-path events consistent with the chat family (status, error_class, applied_guardrails, and the captured request body under the same content_mode=full gate / 401+403 exclusion), plus e2e coverage per endpoint.

Each handler needs an audit of its own error arms (reservation commit, 501 not-implemented paths, upstream_called=false convention) — the chat pattern does not transplant 1:1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions