Add extra trace tagging

This commit is contained in:
Tom Moor
2023-12-08 20:15:07 -05:00
parent fb790c0688
commit cb0d84a803
2 changed files with 20 additions and 0 deletions

View File

@@ -1,9 +1,17 @@
import stream from "stream";
import { Context, Next } from "koa";
import { Readable } from "readable-stream";
import { addTags } from "@server/logging/tracer";
export default function apiWrapper() {
return async function apiWrapperMiddleware(ctx: Context, next: Next) {
const id = ctx.request.body?.id ?? ctx.request.query?.id;
if (id) {
addTags({
"resource.id": `${id}`,
});
}
await next();
const ok = ctx.status < 400;