pub fn classify_upstream_error(err: &GuardrailError) -> &'static strExpand description
Classify a guardrail_core::GuardrailError::Upstream into a coarse
error class for the guardrail_upstream_errors_total metric label.
With the reqwest-errors feature enabled (always on for
guardrail-proxy), this inspects the structured reqwest::Error via
.is_timeout() / .is_connect() rather than string-matching the
Display output, which is more reliable across reqwest/hyper
versions and locales.
ยงExamples
use guardrail_proxy::error::classify_upstream_error;
use guardrail_core::GuardrailError;
let err = GuardrailError::Internal("unrelated".into());
assert_eq!(classify_upstream_error(&err), "other");