How to use the @sentry/node.Hub function in @sentry/node

To help you get started, we’ve selected a few @sentry/node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github integrations / jira / lib / github / middleware.js View on Github external
return async (context) => {
    context.sentry = new Sentry.Hub(Sentry.getCurrentHub().getClient())
    context.sentry.configureScope(scope => scope.addEventProcessor(AxiosErrorEventDecorator.decorate))
    context.sentry.configureScope(scope => scope.addEventProcessor(SentryScopeProxy.processEvent))

    try {
      await callback(context)
    } catch (err) {
      context.sentry.captureException(err)
      throw err
    }
  }
}
github integrations / jira / lib / worker / index.js View on Github external
return async (job) => {
    job.sentry = new Sentry.Hub(Sentry.getCurrentHub().getClient())
    job.sentry.configureScope(scope => scope.addEventProcessor(AxiosErrorEventDecorator.decorate))
    job.sentry.configureScope(scope => scope.addEventProcessor(SentryScopeProxy.processEvent))

    try {
      await jobHandler(job)
    } catch (err) {
      job.sentry.setExtra('job', {
        id: job.id,
        attemptsMade: job.attemptsMade,
        timestamp: new Date(job.timestamp),
        data: job.data
      })

      job.sentry.setTag('jiraHost', job.data.jiraHost)
      job.sentry.setTag('queue', job.queue.name)
      job.sentry.captureException(err)