link static method

Link link({
  1. bool enableBreadcrumbs = true,
  2. required bool shouldStartTransaction,
  3. required bool graphQlErrorsMarkTransactionAsFailed,
  4. bool reportExceptions = true,
  5. bool reportExceptionsAsBreadcrumbs = false,
  6. bool reportGraphQlErrors = true,
  7. bool reportGraphQlErrorsAsBreadcrumbs = false,
})

If shouldStartTransaction is set to true, a SentryTransaction is automatically created for each GraphQL query/mutation. If a transaction is already bound to scope, no SentryTransaction will be started even if shouldStartTransaction is set to true.

If graphQlErrorsMarkTransactionAsFailed is set to true and a query or mutation have a GraphQLError attached, the current SentryTransaction is marked as with SpanStatus.unknownError.

Implementation

static Link link({
  bool enableBreadcrumbs = true,
  required bool shouldStartTransaction,
  required bool graphQlErrorsMarkTransactionAsFailed,
  bool reportExceptions = true,
  bool reportExceptionsAsBreadcrumbs = false,
  bool reportGraphQlErrors = true,
  bool reportGraphQlErrorsAsBreadcrumbs = false,
}) {
  return Link.from([
    SentryLink.link(
      reportExceptions: reportExceptions,
      reportExceptionsAsBreadcrumbs: reportExceptionsAsBreadcrumbs,
      reportGraphQlErrors: reportGraphQlErrors,
      reportGraphQlErrorsAsBreadcrumbs: reportExceptionsAsBreadcrumbs,
    ),
    if (enableBreadcrumbs) SentryBreadcrumbLink(),
    if (shouldStartTransaction != false &&
        graphQlErrorsMarkTransactionAsFailed != false)
      SentryTracingLink(
        graphQlErrorsMarkTransactionAsFailed:
            graphQlErrorsMarkTransactionAsFailed,
        shouldStartTransaction: shouldStartTransaction,
      ),
  ]);
}