Upgrade dd-trace, add APM tracing around key commands, fix tags should be attached to root spans (#3243)
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
EmailAuthenticationRequiredError,
|
||||
AuthenticationProviderDisabledError,
|
||||
} from "@server/errors";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import mailer from "@server/mailer";
|
||||
import { Collection, Team, User } from "@server/models";
|
||||
import teamCreator from "./teamCreator";
|
||||
@@ -43,7 +44,7 @@ export type AccountProvisionerResult = {
|
||||
isNewUser: boolean;
|
||||
};
|
||||
|
||||
export default async function accountProvisioner({
|
||||
async function accountProvisioner({
|
||||
ip,
|
||||
user: userParams,
|
||||
team: teamParams,
|
||||
@@ -142,3 +143,5 @@ export default async function accountProvisioner({
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(accountProvisioner);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import { Collection, Event, Team, User, FileOperation } from "@server/models";
|
||||
import { getAWSKeyForFileOp } from "@server/utils/s3";
|
||||
|
||||
export default async function collectionExporter({
|
||||
async function collectionExporter({
|
||||
collection,
|
||||
team,
|
||||
user,
|
||||
@@ -43,3 +44,5 @@ export default async function collectionExporter({
|
||||
|
||||
return fileOperation;
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(collectionExporter);
|
||||
|
||||
@@ -6,6 +6,7 @@ import invariant from "invariant";
|
||||
import { values, keys } from "lodash";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import Logger from "@server/logging/logger";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import { Attachment, Event, Document, Collection, User } from "@server/models";
|
||||
import { parseOutlineExport, Item } from "@server/utils/zip";
|
||||
import { FileImportError } from "../errors";
|
||||
@@ -17,7 +18,7 @@ type FileWithPath = File & {
|
||||
path: string;
|
||||
};
|
||||
|
||||
export default async function collectionImporter({
|
||||
async function collectionImporter({
|
||||
file,
|
||||
type,
|
||||
user,
|
||||
@@ -198,3 +199,5 @@ export default async function collectionImporter({
|
||||
attachments: values(attachments),
|
||||
};
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(collectionImporter);
|
||||
|
||||
@@ -8,6 +8,7 @@ import TurndownService from "turndown";
|
||||
import utf8 from "utf8";
|
||||
import { MAX_TITLE_LENGTH } from "@shared/constants";
|
||||
import parseTitle from "@shared/utils/parseTitle";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import { User } from "@server/models";
|
||||
import dataURItoBuffer from "@server/utils/dataURItoBuffer";
|
||||
import { deserializeFilename } from "@server/utils/fs";
|
||||
@@ -141,7 +142,7 @@ async function confluenceToMarkdown(file): Promise<string> {
|
||||
return html.replace(/<br>/g, " \\n ");
|
||||
}
|
||||
|
||||
export default async function documentImporter({
|
||||
async function documentImporter({
|
||||
file,
|
||||
user,
|
||||
ip,
|
||||
@@ -212,3 +213,5 @@ export default async function documentImporter({
|
||||
title,
|
||||
};
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(documentImporter);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import invariant from "invariant";
|
||||
import { Transaction } from "sequelize";
|
||||
import { sequelize } from "@server/database/sequelize";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import {
|
||||
User,
|
||||
Document,
|
||||
@@ -62,7 +63,7 @@ type Result = {
|
||||
collectionChanged: boolean;
|
||||
};
|
||||
|
||||
export default async function documentMover({
|
||||
async function documentMover({
|
||||
user,
|
||||
document,
|
||||
collectionId,
|
||||
@@ -238,3 +239,5 @@ export default async function documentMover({
|
||||
// we need to send all updated models back to the client
|
||||
return result;
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(documentMover);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import invariant from "invariant";
|
||||
import Logger from "@server/logging/logger";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import { Team, AuthenticationProvider } from "@server/models";
|
||||
import { isDomainAllowed } from "@server/utils/authentication";
|
||||
import { generateAvatarUrl } from "@server/utils/avatars";
|
||||
@@ -22,7 +23,7 @@ type Props = {
|
||||
};
|
||||
};
|
||||
|
||||
export default async function teamCreator({
|
||||
async function teamCreator({
|
||||
name,
|
||||
domain,
|
||||
subdomain,
|
||||
@@ -125,3 +126,5 @@ export default async function teamCreator({
|
||||
isNewTeam: true,
|
||||
};
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(teamCreator);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Transaction } from "sequelize";
|
||||
import { sequelize } from "@server/database/sequelize";
|
||||
import Logger from "@server/logging/logger";
|
||||
import { APM } from "@server/logging/tracing";
|
||||
import {
|
||||
ApiKey,
|
||||
Attachment,
|
||||
@@ -20,7 +21,7 @@ import {
|
||||
Share,
|
||||
} from "@server/models";
|
||||
|
||||
export default async function teamPermanentDeleter(team: Team) {
|
||||
async function teamPermanentDeleter(team: Team) {
|
||||
if (!team.deletedAt) {
|
||||
throw new Error(
|
||||
`Cannot permanently delete ${team.id} team. Please delete it and try again.`
|
||||
@@ -203,3 +204,5 @@ export default async function teamPermanentDeleter(team: Team) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export default APM.traceFunction({})(teamPermanentDeleter);
|
||||
|
||||
Reference in New Issue
Block a user