mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
fix(logging): carry the route template in http.route
http.route held the concrete pathname, so every record id minted a route of its own and grouping by route answered nothing. apiHandler recovers the template from the handler's params and puts it there; http.path keeps the concrete path, and path-secret redaction still runs on both.
This commit is contained in:
1 parent
fbbb535832
commit
72214c0208
3 files changed
+207
-1
No files matched your search
@@ -11,6 +11,7 @@ import { WideEventBuilder } from "./logging/event-builder";
|
||||
import { annotate, eventStorage, getEvent } from "./logging/context";
|
||||
import { emitIfSampled } from "./logging/transports";
|
||||
import { redactOptional, redactSecrets } from "./logging/redact";
|
||||
import { routeTemplateFor } from "./logging/route-template";
|
||||
import { getSession } from "./auth/session";
|
||||
import {
|
||||
hasSecondFactorEnrolled,
|
||||
@@ -241,7 +242,9 @@ export function apiHandler<T extends (...args: any[]) => Promise<Response>>(
|
||||
evt.setHttp({
|
||||
method: safeRequestProp(request, (r) => r.method, "GET"),
|
||||
path: url.pathname,
|
||||
route: url.pathname,
|
||||
// The handler's template (`/api/medications/[id]`), not the concrete
|
||||
// path: one route per handler, so dashboards can group on it.
|
||||
route: await routeTemplateFor(url.pathname, args[1]),
|
||||
status: 200,
|
||||
user_agent:
|
||||
safeRequestProp(request, (r) => r.headers.get("user-agent"), null) ??
|
||||
|
||||
Reference in new issue
Block a user