recordHTTPDecision writes the resolved decision to the store with HTTP-shaped audit metadata (correlation id from header, user from auth middleware, fallback to the synthetic local user). Realtime has its own recorder that supplies session-derived metadata instead.
(c echo.Context, store router.DecisionStore, result *router.ResolveResult, fallbackUser *auth.User, source string)
| 211 | // has its own recorder that supplies session-derived metadata |
| 212 | // instead. |
| 213 | func recordHTTPDecision(c echo.Context, store router.DecisionStore, result *router.ResolveResult, fallbackUser *auth.User, source string) { |
| 214 | correlationID, _ := c.Get(ContextKeyCorrelationID).(string) |
| 215 | if correlationID == "" { |
| 216 | correlationID = c.Response().Header().Get("X-Correlation-ID") |
| 217 | } |
| 218 | userID := "" |
| 219 | if u := auth.GetUser(c); u != nil { |
| 220 | userID = u.ID |
| 221 | } else if fallbackUser != nil { |
| 222 | userID = fallbackUser.ID |
| 223 | } |
| 224 | _ = store.Record(context.Background(), result.ToDecisionRecord(newDecisionID(), correlationID, userID, source)) |
| 225 | } |
| 226 | |
| 227 | // GetOrBuildClassifier looks up a built Classifier for the named router |
| 228 | // model in the registry and builds it on miss. Exported so the |
no test coverage detected