Skip to content

Commit 844b3fc

Browse files
committed
simplified getPath function
1 parent fcf6fa1 commit 844b3fc

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

packages/datadog-plugin-graphql/src/resolve.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GraphQLResolvePlugin extends TracingPlugin {
1212
start (fieldCtx) {
1313
const { info, rootCtx, args, path: pathAsArray, pathString } = fieldCtx
1414

15-
const path = getPath(info, this.config, pathAsArray)
15+
const path = getPath(this.config, pathAsArray)
1616

1717
// we need to get the parent span to the field if it exists for correct span parenting
1818
// of nested fields
@@ -76,9 +76,9 @@ class GraphQLResolvePlugin extends TracingPlugin {
7676
super(...args)
7777

7878
this.addTraceSub('updateField', (ctx) => {
79-
const { field, info, error, path: pathAsArray } = ctx
79+
const { field, error, path: pathAsArray } = ctx
8080

81-
const path = getPath(info, this.config, pathAsArray)
81+
const path = getPath(this.config, pathAsArray)
8282

8383
if (!shouldInstrument(this.config, path)) return
8484

@@ -118,11 +118,10 @@ function shouldInstrument (config, path) {
118118
return config.depth < 0 || config.depth >= depth
119119
}
120120

121-
function getPath (info, config, pathAsArray) {
122-
const responsePathAsArray = config.collapse
121+
function getPath (config, pathAsArray) {
122+
return config.collapse
123123
? withCollapse(pathAsArray)
124124
: pathAsArray
125-
return typeof responsePathAsArray === 'function' ? responsePathAsArray(info && info.path) : responsePathAsArray
126125
}
127126

128127
function withCollapse (pathAsArray) {

0 commit comments

Comments
 (0)