diff --git a/.changesets/only-instrument-fs-with-parent-span.md b/.changesets/only-instrument-fs-with-parent-span.md new file mode 100644 index 00000000..309060ea --- /dev/null +++ b/.changesets/only-instrument-fs-with-parent-span.md @@ -0,0 +1,6 @@ +--- +bump: "patch" +type: "fix" +--- + +Prevent creating fs-only samples by only creating an fs span if there is a parent span present. diff --git a/src/client.ts b/src/client.ts index 7f9644f1..65c93f6b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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 @@ -299,6 +300,11 @@ export class Client { }, "@prisma/instrumentation": { middleware: true + }, + "@opentelemetry/instrumentation-fs": { + createHook: () => { + return trace.getActiveSpan() !== undefined + } } } }