src/Tracer.js
function addTracingToResolvers(schema) {
  // XXX this is a hacky way of making sure that the schema only gets decorated
  // with tracer once.
  if (schema._apolloTracerApplied) {
    // console.log('Tracing already added to resolve functions. Not adding again.');
    return;
  }
  // eslint-disable-next-line no-param-reassign
  schema._apolloTracerApplied = true;

  forEachField(schema, (field, typeName, fieldName) => {
    const functionName = `${typeName}.${fieldName}`;
    if (field.resolve) {
      // eslint-disable-next-line no-param-reassign
      field.resolve = decorateWithTracer(
        field.resolve,
        { type: 'resolve', functionName },
      );
    }
  });
}
function addTracingToResolvers(schema) {
  // XXX this is a hacky way of making sure that the schema only gets decorated
  // with tracer once.
  if (schema._apolloTracerApplied) {
    // console.log('Tracing already added to resolve functions. Not adding again.');
    return;
  }
  // eslint-disable-next-line no-param-reassign
  schema._apolloTracerApplied = true;

  forEachField(schema, (field, typeName, fieldName) => {
    const functionName = `${typeName}.${fieldName}`;
    if (field.resolve) {
      // eslint-disable-next-line no-param-reassign
      field.resolve = decorateWithTracer(
        field.resolve,
        { type: 'resolve', functionName },
      );
    }
  });
}
function addTracingToResolvers ( schema ) { // XXX this is a hacky way of making sure that the schema only gets decorated // with tracer once. if ( schema . _apolloTracerApplied ) { // console.log('Tracing already added to resolve functions. Not adding again.'); return ; } // eslint-disable-next-line no-param-reassign schema . _apolloTracerApplied = true ; forEachField ( schema , ( field , typeName , fieldName ) => { const functionName = ` ${ typeName } ${ fieldName } ` ; if ( field . resolve ) { // eslint-disable-next-line no-param-reassign field . resolve = decorateWithTracer ( field . resolve , { type : 'resolve' , functionName } , ) ; } } ) ; }
This function modifies the schema in place to add tracing around all resolve functions
This function modifies the schema in place to add tracing around all resolve functions