Add extra trace tagging
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
} from "@shared/utils/date";
|
} from "@shared/utils/date";
|
||||||
import attachmentCreator from "@server/commands/attachmentCreator";
|
import attachmentCreator from "@server/commands/attachmentCreator";
|
||||||
import { parser, schema } from "@server/editor";
|
import { parser, schema } from "@server/editor";
|
||||||
|
import { addTags } from "@server/logging/tracer";
|
||||||
import { trace } from "@server/logging/tracing";
|
import { trace } from "@server/logging/tracing";
|
||||||
import { Document, Revision, User } from "@server/models";
|
import { Document, Revision, User } from "@server/models";
|
||||||
import FileStorage from "@server/storage/files";
|
import FileStorage from "@server/storage/files";
|
||||||
@@ -113,6 +114,11 @@ export default class DocumentHelper {
|
|||||||
centered: options?.centered,
|
centered: options?.centered,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addTags({
|
||||||
|
documentId: document.id,
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
|
||||||
if (options?.signedUrls) {
|
if (options?.signedUrls) {
|
||||||
const teamId =
|
const teamId =
|
||||||
document instanceof Document
|
document instanceof Document
|
||||||
@@ -157,6 +163,12 @@ export default class DocumentHelper {
|
|||||||
after: Revision,
|
after: Revision,
|
||||||
{ signedUrls, ...options }: HTMLOptions = {}
|
{ signedUrls, ...options }: HTMLOptions = {}
|
||||||
) {
|
) {
|
||||||
|
addTags({
|
||||||
|
beforeId: before?.id,
|
||||||
|
documentId: after.documentId,
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
|
||||||
if (!before) {
|
if (!before) {
|
||||||
return await DocumentHelper.toHTML(after, { ...options, signedUrls });
|
return await DocumentHelper.toHTML(after, { ...options, signedUrls });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
import stream from "stream";
|
import stream from "stream";
|
||||||
import { Context, Next } from "koa";
|
import { Context, Next } from "koa";
|
||||||
import { Readable } from "readable-stream";
|
import { Readable } from "readable-stream";
|
||||||
|
import { addTags } from "@server/logging/tracer";
|
||||||
|
|
||||||
export default function apiWrapper() {
|
export default function apiWrapper() {
|
||||||
return async function apiWrapperMiddleware(ctx: Context, next: Next) {
|
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();
|
await next();
|
||||||
const ok = ctx.status < 400;
|
const ok = ctx.status < 400;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user