@@ -248,119 +248,6 @@ describe('OpenTelemetry', () => {
248
248
} ) ;
249
249
} ) ;
250
250
251
- it . only ( 'should report telemetry metrics correctly to jaeger' , async ( ) => {
252
- const serviceName = crypto . randomUUID ( ) ;
253
- const { execute } = await gateway ( {
254
- supergraph,
255
- env : {
256
- OTLP_EXPORTER_TYPE ,
257
- OTLP_EXPORTER_URL : urls [ OTLP_EXPORTER_TYPE ] ,
258
- OTEL_SERVICE_NAME : serviceName ,
259
- OTEL_SERVICE_VERSION : '1.0.0' ,
260
- } ,
261
- } ) ;
262
-
263
- /*
264
- await expect(execute({ query: exampleSetup.query })).resolves.toEqual(
265
- exampleSetup.result,
266
- );
267
- /*/
268
- await expect (
269
- execute ( { query : 'query test { unknown }' } ) ,
270
- ) . resolves . toEqual ( {
271
- errors : [
272
- {
273
- message : 'Cannot query field "unknown" on type "Query".' ,
274
- extensions : {
275
- code : 'GRAPHQL_VALIDATION_FAILED' ,
276
- } ,
277
- locations : [
278
- {
279
- column : 14 ,
280
- line : 1 ,
281
- } ,
282
- ] ,
283
- } ,
284
- ] ,
285
- } ) ;
286
- //*/
287
- await expectJaegerTraces ( serviceName , ( traces ) => {
288
- const relevantTraces = traces . data . filter ( ( trace ) =>
289
- trace . spans . some ( ( span ) =>
290
- span . operationName . startsWith ( 'graphql.operation' ) ,
291
- ) ,
292
- ) ;
293
- expect ( relevantTraces . length ) . toBe ( 1 ) ;
294
- const relevantTrace = relevantTraces [ 0 ] ;
295
- expect ( relevantTrace ) . toBeDefined ( ) ;
296
-
297
- // const resource = relevantTrace!.processes['p1'];
298
- // expect(resource).toBeDefined();
299
-
300
- // const tags = resource!.tags.map(({ key, value }) => ({ key, value }));
301
- // // const tagKeys = resource!.tags.map(({ key }) => key);
302
- // expect(resource!.serviceName).toBe(serviceName);
303
- // [
304
- // ['custom.resource', 'custom value'],
305
- // ['otel.library.name', 'gateway'],
306
- // ].forEach(([key, value]) => {
307
- // return expect(tags).toContainEqual({ key, value });
308
- // });
309
-
310
- // if (
311
- // gatewayRunner === 'node' ||
312
- // gatewayRunner === 'docker' ||
313
- // gatewayRunner === 'bin'
314
- // ) {
315
- // const expectedTags = [
316
- // 'process.owner',
317
- // 'host.arch',
318
- // 'os.type',
319
- // 'service.instance.id',
320
- // ];
321
- // if (gatewayRunner.includes('docker')) {
322
- // expectedTags.push('container.id');
323
- // }
324
- // expectedTags.forEach((key) => {
325
- // return expect(tags).toContainEqual(
326
- // expect.objectContaining({ key }),
327
- // );
328
- // });
329
- // }
330
-
331
- // const spanTree = buildSpanTree(relevantTrace!.spans, 'POST /graphql');
332
- // expect(spanTree).toBeDefined();
333
-
334
- // expect(spanTree!.children).toHaveLength(1);
335
-
336
- const operationSpan = buildSpanTree (
337
- relevantTrace ! . spans ,
338
- 'graphql.operation' ,
339
- ) ! ;
340
- const expectedOperationChildren = [
341
- 'graphql.parse' ,
342
- 'graphql.validate' ,
343
- ] ;
344
- // expect(operationSpan!.children).toHaveLength(
345
- // expectedOperationChildren.length,
346
- // );
347
- for ( const operationName of expectedOperationChildren ) {
348
- expect ( operationSpan ?. children ) . toContainEqual (
349
- expect . objectContaining ( {
350
- span : expect . objectContaining ( { operationName } ) ,
351
- } ) ,
352
- ) ;
353
- }
354
-
355
- console . log ( operationSpan . span . tags ) ;
356
- expect (
357
- operationSpan . span . tags . find (
358
- ( { key } ) => key === 'graphql.operation.name' ,
359
- ) ,
360
- ) . toMatchObject ( { value : 'TestQuery' } ) ;
361
- } ) ;
362
- } ) ;
363
-
364
251
it ( 'should report telemetry metrics correctly to jaeger using cli options' , async ( ) => {
365
252
const serviceName = crypto . randomUUID ( ) ;
366
253
const { execute } = await gateway ( {
0 commit comments