UNPKG

@envelop/sentry

Version:

This plugins collects errors and performance tracing for your execution flow, and reports it to [Sentry](https://sentry.io/).

82 lines (81 loc) 2.7 kB
import { Plugin } from '@envelop/core'; import * as Sentry from '@sentry/node'; import type { TraceparentData } from '@sentry/types'; import { ExecutionArgs } from 'graphql'; export declare type SentryPluginOptions = { /** * Starts a new transaction for every GraphQL Operation. * When disabled, an already existing Transaction will be used. * * @default true */ startTransaction?: boolean; /** * Renames Transaction. * @default false */ renameTransaction?: boolean; /** * Creates a Span for every resolve function * @default true */ trackResolvers?: boolean; /** * Adds result of each resolver and operation to Span's data (available under "result") * @default false */ includeRawResult?: boolean; /** * Adds arguments of each resolver to Span's tag called "args" * @default false */ includeResolverArgs?: boolean; /** * Adds operation's variables to a Scope (only in case of errors) * @default false */ includeExecuteVariables?: boolean; /** * The key of the event id in the error's extension. `null` to disable. * @default sentryEventId */ eventIdKey?: string | null; /** * Adds custom tags to every Transaction. */ appendTags?: (args: ExecutionArgs) => Record<string, unknown>; /** * Callback to set context information onto the scope. */ configureScope?: (args: ExecutionArgs, scope: Sentry.Scope) => void; /** * Produces a name of Transaction (only when "renameTransaction" or "startTransaction" are enabled) and description of created Span. * * @default operation's name or "Anonymous Operation" when missing) */ transactionName?: (args: ExecutionArgs) => string; /** * Produces tracing data for Transaction * * @default is empty */ traceparentData?: (args: ExecutionArgs) => TraceparentData | undefined; /** * Produces a "op" (operation) of created Span. * * @default execute */ operationName?: (args: ExecutionArgs) => string; /** * Indicates whether or not to skip the entire Sentry flow for given GraphQL operation. * By default, no operations are skipped. */ skip?: (args: ExecutionArgs) => boolean; /** * Indicates whether or not to skip Sentry exception reporting for a given error. * By default, this plugin skips all `Error` errors and does not report it to Sentry. */ skipError?: (args: Error) => boolean; }; export declare function defaultSkipError(error: Error): boolean; export declare const useSentry: (options?: SentryPluginOptions) => Plugin;