@pointblankdev/apollo-plugin-sentry
TypeScript icon, indicating that this package has built-in type declarations

0.0.6Β β€’Β PublicΒ β€’Β Published

Apollo-Plugin-Sentry

styled with prettier Gitmoji


An Apollo Plugin for Sentry Monitoring πŸ”

Tracking Errors in Apollo GraphQL with Sentry


How it works

Apollo server uses lifecycle events, enabling us to easily instrument an app for sentry integration.

Here's a visual diagram of the flow of lifecycle events. Learn more at the Apollo Plugin Docs πŸ“š

Lifecycle Events Diagram


Install

# yarn
yarn add @pointblankdev/apollo-plugin-sentry

# npm
npm install @pointblankdev/apollo-plugin-sentry

Usage

  • To get started, you need to have a Sentry DSN which you can get here. This value should be assigned to the SENTRY_DSN environment variable.
  • Make sure you have the ENV variable set so Sentry knows which environment to use for tracking your errors
Pre 0.0.6
  • Import the package and pass an array containing the variable to the plugin options of your Apollo Server and you're good to go πŸš€

    const {
      sentryPlugin,
    } = require('@pointblankdev/apollo-plugin-sentry');
    
    const server = new ApolloServer({
        ...,
        plugins: [sentryPlugin],
    });
>= 0.0.6
  • Import the package, initialize it by calling it with an optional service name, pass the result to the plugin options of your Apollo Server and you're good to go

    const {
      sentryPlugin,
    } = require('@pointblankdev/apollo-plugin-sentry');
    
    const plugin = sentryPlugin('my-repo');
    const server = new ApolloServer({
        ...,
        plugins: [plugin],
    });
  • The service name is added as a service_name tag in your error reporting, therefore making it much easier to identify individual services at first glance when you have a project that serves multiple services.

Readme

Keywords

Package Sidebar

Install

npm i @pointblankdev/apollo-plugin-sentry

Weekly Downloads

17

Version

0.0.6

License

MIT

Unpacked Size

12.9 kB

Total Files

11

Last publish

Collaborators

  • sijupoint
  • victor_dev
  • atuki
  • yungdenzel
  • naalaryea
  • laoye_jnr
  • pointblankigbominadeveloper
  • rozar