Skip to content

Commit

Permalink
Only instrument fs with parent span
Browse files Browse the repository at this point in the history
To avoid having spans consisting entirely of an `fs` invocation,
such as those originating from reading files on boot, only instrument
`fs` calls if there already is a root span.
  • Loading branch information
unflxw committed Dec 27, 2022
1 parent 92851af commit 3cb4355
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setParams, setSessionData } from "./helpers"
import { BaseLogger, Logger, LoggerLevel } from "./logger"

import { Instrumentation } from "@opentelemetry/instrumentation"
import { trace } from "@opentelemetry/api"
import {
ExpressInstrumentation,
ExpressLayerType
Expand Down Expand Up @@ -299,6 +300,11 @@ export class Client {
},
"@prisma/instrumentation": {
middleware: true
},
"@opentelemetry/instrumentation-fs": {
createHook: () => {
return trace.getActiveSpan() !== undefined
}
}
}
}
Expand Down

0 comments on commit 3cb4355

Please sign in to comment.