chore: Move tracing decorators into the codebase (#4623)

* Vendorize tracing, finally fix service name issues

* Upgrade datadaog-metrics, rename decorators -> tracing

* lint
This commit is contained in:
Tom Moor
2022-12-31 12:54:51 +00:00
committed by GitHub
parent 1e036ebd0e
commit c6fb764631
26 changed files with 501 additions and 190 deletions

View File

@@ -1,6 +1,9 @@
import { Next } from "koa";
import Logger from "@server/logging/Logger";
import tracer, { APM } from "@server/logging/tracing";
import tracer, {
addTags,
getRootSpanFromRequestContext,
} from "@server/logging/tracer";
import { User, Team, ApiKey } from "@server/models";
import { getUserForJWT } from "@server/utils/jwt";
import {
@@ -130,13 +133,13 @@ export default function auth(options: AuthenticationOptions = {}) {
ctx.state.user = user;
if (tracer) {
APM.addTags(
addTags(
{
"request.userId": user.id,
"request.teamId": user.teamId,
"request.authType": ctx.state.authType,
},
APM.getRootSpanFromRequestContext(ctx)
getRootSpanFromRequestContext(ctx)
);
}
}