appsignal

Introducing Support for Apollo Gateway

Connor James

Connor James on

Introducing Support for Apollo Gateway

AppSignal now offers Apollo Gateway support, giving you span-level gateway performance insights to enhance Apollo Gateway performance in your Node.js applications.

In this blog post, we'll give you a whistle-stop tour of how to instrument and monitor Apollo Gateway requests in your Node.js application.

Getting Started

AppSignal's Apollo Gateway support helps you:

  • ✅ Identify expensive N+1 queries
  • ✅ Analyze root spans
  • ✅ Squash bugs in your gateway, subgraphs, and beyond
  • ✅ Quickly analyze root spans to find and fix bottlenecks

You can instrument Apollo Gateway in just three simple steps:

1. Upgrade Your AppSignal Package

Ensure your Node.js application is using version 3.3.0 or higher of the AppSignal package.

For example, with npm:

Shell
npm update @appsignal/nodejs

Or with yarn:

Shell
yarn upgrade @appsignal/nodejs

2. Disable Gateway GraphQL Instrumentation

For the Apollo Gateway instrumentation to work, you first need to disable GraphQL in your gateway service. This enables the gateway to send its own @apollo/gateway OpenTelemetry spans.

To do so, use the disableDefaultInstrumentations option in the AppSignal configuration:

Nodejs
const { Appsignal } = require("@appsignal/nodejs"); new Appsignal({ active: true, name: "your-app-name", pushApiKey: "your-push-api-key", disableDefaultInstrumentations: ["@opentelemetry/instrumentation-graphql"], });

3. Enable OpenTelemetry in the Apollo Gateway Config

To send @apollo/gateway OpenTelemetry spans to AppSignal, you need to enable telemetry in your Apollo Gateway config:

Nodejs
const config = { telemetry: { includeDocument: true, reportExceptions: 1, }, };

Monitoring Apollo Gateway With AppSignal

Let's say you're using Apollo Gateway to federate your Orders and Customers GraphQL servers:

Diagram of Apollo Gateway connecting to two GraphQL servers

What if we request the getAllOrders query from our Apollo Gateway service? AppSignal will instrument the gateway request to the Orders subgraph, giving you a high-level overview of how subgraphs in your gateway are performing:

Diagram of Apollo Gateway Event Sample and Event Timeline

At the same time, the query your gateway sends to the Orders subgraph is also instrumented with AppSignal's out-of-the-box GraphQL. So you gain the same deep, subgraph-level insights into query performance.

AppSignal: The Node.js APM Tool

Node.js developers use AppSignal daily to monitor and enhance their Node.js applications, thanks to our:

  • Intuitive interface that is easy to navigate.
  • Simple and predictable pricing.
  • Friendly developer-to-developer support.

New to AppSignal? With our installation wizard, we can have you up and monitoring within minutes. We'll even send you free delicious stroopwafels once you start sending us your app's metrics.

Simply start a free trial and join the thousands of developers relying on AppSignal to monitor and enhance their code today!

Connor James

Connor James

Official technical writer at AppSignal. Podcast addict who loves cannoli so much that he's considering changing his name to Connoli. He thinks there's a `u` in color. You might find him on the mic, on the stage, or lying on the sofa when he's off Documentation Duty.

All articles by Connor James

Become our next author!

Find out more

AppSignal monitors your apps

AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

Discover AppSignal
AppSignal monitors your apps