This package provides a simple vue plugin to configure Sentry.
$ npm install --save-dev @infermedica/vue-sentry-pluginThe Sentry plugin has to be configured in Webpack configuration file through webpack.DefinePlugin:
new webpack.DefinePlugin({
__sentry: JSON.stringify({
isEnabled: process.env.NODE_ENV === 'production',
dsn: 'https://XXX@sentry.io/XXX',
environment: process.env.NODE_ENV === 'production' ? 'production' : 'local',
release: '<release-identifier>'
})
})To use the module, just import the VueSentry object and install the plugin in Vue.
import VueSentry from '@infermedica/vue-sentry-plugin';
Vue.use(VueSentry);The plugin will be avaliabe under VueSentry and in components under this.$sentry.
This plugin automatically sets two Sentry tags:
- "instance" to the value of
window.location.hostname - "event_layer" to the value "frontend"
this.$sentry.setTag('tag_name', 'tag_value');this.$sentry.setUser(currentUser.id, currentUser.username, currentUser.name);this.$sentry.setActiveInterfaceLanguage('en');This just sets a tag 'i18n.locale' to given value.
The global Sentry object is also avaliable through the plugin, so one can access the core sentry functionality.
this.$sentry.SentryWe're happy to accept pull requests with additional integrations. Feel free to raise an issue if you have any questions or suggestions.
MIT Copyright (c) Infermedica