Skip to content

Commit 204c234

Browse files
committed
fix: escape hatch for missing datadog context
Signed-off-by: Matt Krick <[email protected]>
1 parent 59ba671 commit 204c234

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: packages/server/utils/useDatadogTracing.ts

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export const useDatadogTracing = (config: Config): Plugin<DDContext & ServerCont
5757
const path = getPath(info, config)
5858
const computedPathString = path.join('.')
5959
const ddContext = context[ddSymbol]
60+
// context is set in onExecute or onSubscribe, depending on the parent operation
61+
// if the parent operation did not set context, then the resolver has no parent & we cannot continue
62+
if (!ddContext) return
6063
const {rootSpan, fields} = ddContext
6164
// if collapsed, we just measure the first item in a list
6265
if (config.collapse && fields[computedPathString]) return

0 commit comments

Comments
 (0)