3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

@nuxtjs/sentry で全てのエラー送信にタグを追加する

Posted at

@nuxtjs/sentry のインストール

$ yarn add --dev @nuxtjs/sentry

初期設定

nuxt.config.js
modules: [
  '@nuxtjs/sentry'
],
sentry: {
  dsn: 'https://xxxxxx', // SentryのDSNを記述
  config: {
    // configを追加したい場合は記述
  }
}

Nuxtプラグインを作成

plugins/my-sentry.js
export default ({ app }) => {
  app.$sentry.configureScope(scope => {
    scope.setTag('tagName', 'foo')
  })
}
nuxt.config.js
plugins: [
  '~/plugins/my-sentry'
]

タグに限らず一括でcontextを操作したいときには使えるテクニックかと思います。
https://docs.sentry.io/enriching-error-data/context/?platform=javascript

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?