@lightspeed/apollo-new-relic-extension
v0.1.12
Published
New Relic logging extension for Apollo GraphQL services
Downloads
294
Keywords
Readme
@lightspeed/apollo-new-relic-extension
Introduction
New Relic logging extension for GraphQL services. This extension will log all GraphQL transactions as New Relic transactions, providing insight into the operation query, an easily digestable time tracing summary, and a total error count.
Quick Start
- Install the dependency in your webapp.
yarn add newrelic @lightspeed/apollo-new-relic-extension
Configure New Relic by either creating a
newrelic.js
configuration file at the root directory of your service, or setting environment variables as described here. You will at least need to set theapp_name
andlicense_key
configurations.Add
require('newrelic');
as the first line of your application's entry point. Modules syncronously loaded after New Relic will be instrumented appropriately.Enable the extension and tracing in your Apollo server configuration.
import ApolloNewRelicExtension from '@lightspeed/apollo-new-relic-extension';
// server.ts
const server = new ApolloServer({
// ...
extensions: [() => new ApolloNewRelicExtension()],
tracing: true,
});