Skip to content

Commit

Permalink
Report streaming in datadog traces (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasryaric authored Sep 27, 2023
1 parent 229efab commit 34233a9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions front/logger/withlogging.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tracer from "dd-trace";
import StatsD from "hot-shots";
import { NextApiRequest, NextApiResponse } from "next";

Expand All @@ -9,6 +10,10 @@ export const statsDClient = new StatsD();

export const withLogging = (handler: any, streaming = false) => {
return async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
const ddtraceSpan = tracer.scope().active();
if (ddtraceSpan) {
ddtraceSpan.setTag("streaming", streaming);
}
const now = new Date();
try {
await handler(req, res);
Expand Down

0 comments on commit 34233a9

Please sign in to comment.