@@ -134,19 +134,18 @@ describe('Plugin', () => {
134
134
} )
135
135
it ( 'should instrument apollo/gateway' , done => {
136
136
const operationName = 'MyQuery'
137
- const resource = `query ${ operationName } `
138
- const source = `${ resource } { hello(name: "world") }`
137
+ const source = `query ${ operationName } { hello(name: "world") }`
139
138
const variableValues = { who : 'world' }
140
139
agent
141
140
. use ( ( traces ) => {
142
141
// the spans are in order of execution
143
142
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . server . opName )
144
143
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , expectedSchema . server . serviceName )
145
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , resource )
144
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'query MyQuery{hello(name:"")}' )
146
145
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'web' )
147
146
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'error' , 0 )
148
147
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.operation.name' , operationName )
149
- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.source' , source )
148
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . not . have . property ( 'graphql.source' )
150
149
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.operation.type' , 'query' )
151
150
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'apollo.gateway' )
152
151
@@ -196,10 +195,10 @@ describe('Plugin', () => {
196
195
. use ( ( traces ) => {
197
196
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . server . opName )
198
197
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , expectedSchema . server . serviceName )
199
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'query ' )
198
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , '{hello(name:"")} ' )
200
199
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'web' )
201
200
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'error' , 0 )
202
- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.source' , source )
201
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . not . have . property ( 'graphql.source' )
203
202
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.operation.type' , 'query' )
204
203
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'apollo.gateway' )
205
204
} )
@@ -228,10 +227,10 @@ describe('Plugin', () => {
228
227
. use ( ( traces ) => {
229
228
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . server . opName )
230
229
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , expectedSchema . server . serviceName )
231
- expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'query ' )
230
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , '{human{address{civicNumber street}name}} ' )
232
231
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'web' )
233
232
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'error' , 0 )
234
- expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.source' , source )
233
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . not . have . property ( 'graphql.source' )
235
234
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.operation.type' , 'query' )
236
235
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'apollo.gateway' )
237
236
} )
@@ -315,8 +314,7 @@ describe('Plugin', () => {
315
314
it ( 'should instrument plan failure' , done => {
316
315
let error
317
316
const operationName = 'MyQuery'
318
- const resource = `subscription ${ operationName } `
319
- const source = `${ resource } { hello(name: "world") }`
317
+ const source = `subscription ${ operationName } { hello(name: "world") }`
320
318
const variableValues = { who : 'world' }
321
319
agent
322
320
. use ( ( traces ) => {
@@ -350,8 +348,7 @@ describe('Plugin', () => {
350
348
it ( 'should instrument fetch failure' , done => {
351
349
let error
352
350
const operationName = 'MyQuery'
353
- const resource = `query ${ operationName } `
354
- const source = `${ resource } { hello(name: "world") }`
351
+ const source = `query ${ operationName } { hello(name: "world") }`
355
352
const variableValues = { who : 'world' }
356
353
agent
357
354
. use ( ( traces ) => {
@@ -410,8 +407,7 @@ describe('Plugin', () => {
410
407
411
408
it ( 'should run spans in the correct context' , done => {
412
409
const operationName = 'MyQuery'
413
- const resource = `query ${ operationName } `
414
- const source = `${ resource } { hello(name: "world") }`
410
+ const source = `query ${ operationName } { hello(name: "world") }`
415
411
const variableValues = { who : 'world' }
416
412
417
413
agent
@@ -446,8 +442,7 @@ describe('Plugin', () => {
446
442
withNamingSchema (
447
443
( ) => {
448
444
const operationName = 'MyQuery'
449
- const resource = `query ${ operationName } `
450
- const source = `${ resource } { hello(name: "world") }`
445
+ const source = `query ${ operationName } { hello(name: "world") }`
451
446
const variableValues = { who : 'world' }
452
447
gateway ( )
453
448
. then ( ( { executor } ) => {
@@ -464,18 +459,19 @@ describe('Plugin', () => {
464
459
465
460
describe ( 'with configuration' , ( ) => {
466
461
before ( ( ) => {
467
- return agent . load ( 'apollo' , { service : 'custom' } )
462
+ return agent . load ( 'apollo' , { service : 'custom' , source : true , signature : false } )
468
463
} )
469
464
470
465
it ( 'should be configured with the correct values' , done => {
471
466
const operationName = 'MyQuery'
472
- const resource = `query ${ operationName } `
473
- const source = `${ resource } { hello(name: "world") }`
467
+ const source = `query ${ operationName } { hello(name: "world") }`
474
468
const variableValues = { who : 'world' }
475
469
agent
476
470
. use ( ( traces ) => {
477
471
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'name' , expectedSchema . server . opName )
478
472
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , 'custom' )
473
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , `query ${ operationName } ` )
474
+ expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'graphql.source' , source )
479
475
480
476
expect ( traces [ 0 ] [ 1 ] ) . to . have . property ( 'name' , 'apollo.gateway.validate' )
481
477
expect ( traces [ 0 ] [ 1 ] ) . to . have . property ( 'service' , 'custom' )
0 commit comments