Serve
Features
Monitoring/Tracing
New Relic

New Relic

💡

This page is currently under construction and expected to change. Please feel free to reach out to us directly in case you are having any troubles.

If you wish to integrate NewRelic for tracing, monitoring and error reporting, you can use @graphql-mesh/plugin-newrelic.

You can instrument your GraphQL application with New Relic reporting in order to take advantage of Distributed tracing to monitor performance and errors whilst ultimately getting to the root cause of issues.

image

Getting Started

npm i @graphql-mesh/plugin-newrelic newrelic

Enabling required NewRelic feature flags

Some additional configuration is needed to allow Mesh send the collected information correctly to NewRelic.

You can add the following to your .env file;

.env
NEW_RELIC_FEATURE_FLAG_UNDICI_INSTRUMENTATION=true
NEW_RELIC_FEATURE_FLAG_UNDICI_ASYNC_TRACKING=true
NEW_RELIC_FEATURE_FLAG_NEW_PROMISE_TRACKING=true

or you can add the following to your NewRelic configuration file newrelic.ts;

newrelic.ts
exports.config = {
  // ...
  feature_flag: {
    undici_instrumentation: true,
    undici_async_tracking: true,
    new_promise_tracking: true
  }
}

Example Configuration

mesh.config.ts
import useNewRelic from '@graphql-mesh/plugin-newrelic'
import { defineConfig } from '@graphql-mesh/serve-cli'
 
export const serveConfig = defineConfig({
  plugins: pluginCtx => [
    useNewRelic({
      ...pluginCtx,
      // default `false`. When set to `true`, includes the GraphQL document defining the operations and fragments
      includeDocument: true,
      // default `false`. When set to `true`, includes all the operation variables with their values
      includeExecuteVariables: false,
      // default: `false`. When set to `true`, includes the execution result
      includeRawResult: false,
      // default `false`. When set to `true`, track resolvers as segments to monitor their performance
      trackResolvers: true,
      // default `false`. When set to `true`, includes all the arguments passed to resolvers with their values
      includeResolverArgs: false,
      // default `false`. When set to `true` append the names of operation root fields to the transaction name
      rootFieldsNaming: true,
      // Allows to set a custom operation name to be used as transaction name and attribute
      extractOperationName: "{context.headers['x-operation-name']}"
    })
  ]
})

See here for more advanced options