v2
Guides
Monitoring and Tracing

Monitoring and Tracing

If something is not working as it should within your GraphQL server you would not want it to go unnoticed. Envelop has a wide variety of plugins for different error tracking and performance monitoring services.

Sentry

Sentry is the biggest player regarding error tracking within JavaScript land. With the useSentry plugin any error can be tracked with a proper context, containing important information for tracking down the root cause of the error.

Example reported error on sentry

As with any other envelop plugin, the setup is straight forward!

import { envelop } from '@envelop/core'
import { useSentry } from '@envelop/sentry'
 
const getEnveloped = envelop({
  plugins: [
    // ... other plugins
    useSentry()
  ]
})

DataDog, InfluxDB, Telegraf, StatsD

You can use useStatsD plugin to collect and send metrics to Datadog’s DogStatsD and InfluxDB’s Telegraf StatsD services.

Learn more about the useStatsD plugin.

OpenTelemetry

OpenTelemetry is a possible alternative for Sentry that allows tracking errors as exceptions. Learn more about the useOpenTelemetry plugin.

Prometheus

Prometheus is a platform for scraping metrics from services and utilities. You can use usePrometheus plugin to expose and collect metrics from all phases of your GraphQL execution.

Learn more about the usePrometheus plugin.

New Relic

If you wish to integrate NewRelic for tracing, monitoring and error reporting, you can use useNewRelic plugin.

Example NewRelic

As with any other envelop plugin the setup is straight forward!

import { envelop } from '@envelop/core'
import { useNewRelic } from '@envelop/newrelic'
 
const getEnveloped = envelop({
  plugins: [
    // ... other plugins
    useNewRelic({
      // ...
    })
  ]
})

Learn more about the useNewRelic plugin.

Apollo-Tracing

Apollo introduced the apollo-tracing specification and implemented it in apollo-server. With envelop it is possible to use apollo-tracing for tracking down slow resolvers with any server.

import * as GraphQLJS from 'graphql'
import { envelop } from '@envelop/core'
import { useApolloTracing } from '@envelop/apollo-tracing'
import { envelop, useEngine } from '@envelop/core'
 
const getEnveloped = envelop({
  plugins: [
    useEngine(GraphQLJS),
    // ... other plugins
    useApolloTracing()
  ]
})

Also, if you are using GraphQL Playground as part of your setup, you’ll be able to see the tracing information under TRACING section:

Example for using ApolloTracing with Playground