https://github.com/pointblankdev/apollo-plugin-sentry
TBD
https://github.com/pointblankdev/apollo-plugin-sentry
Last synced: 2 months ago
JSON representation
TBD
- Host: GitHub
- URL: https://github.com/pointblankdev/apollo-plugin-sentry
- Owner: pointblankdev
- License: mit
- Created: 2021-10-07T14:57:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T23:12:06.000Z (over 4 years ago)
- Last Synced: 2025-07-26T06:21:03.239Z (11 months ago)
- Language: TypeScript
- Size: 131 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# Apollo-Plugin-Sentry
[](https://github.com/prettier/prettier)
An Apollo Plugin for Sentry Monitoring 🔍
[Tracking Errors in Apollo GraphQL with Sentry](https://medium.com/@mahyor.sam/tracking-errors-in-apollo-graphql-with-sentry-549ae52c0c76)
## 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 📚](https://www.apollographql.com/docs/apollo-server/integrations/plugins/)

## Install
```bash
# 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](https://sentry,io). 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');
```
```bash
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
```bash
const {
sentryPlugin,
} = require('@pointblankdev/apollo-plugin-sentry');
const plugin = sentryPlugin('my-repo');
```
```bash
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.