@infermedica/vue-sentry-plugin

0.1.1 • Public • Published

Infermedica Vue Sentry Plugin

This package provides a simple vue plugin to configure Sentry.

Installation

$ npm install --save-dev @infermedica/vue-sentry-plugin

Configuration

The 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>'
  })
})

Usage

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"

Set additional global Sentry tags

this.$sentry.setTag('tag_name', 'tag_value');

Set active user in Sentry

this.$sentry.setUser(currentUser.id, currentUser.username, currentUser.name);

Set active interface language in Sentry

this.$sentry.setActiveInterfaceLanguage('en');

This just sets a tag 'i18n.locale' to given value.

Access Sentry object

The global Sentry object is also avaliable through the plugin, so one can access the core sentry functionality.

this.$sentry.Sentry

Contribution

We're happy to accept pull requests with additional integrations. Feel free to raise an issue if you have any questions or suggestions.

License

MIT Copyright (c) Infermedica

Readme

Keywords

Package Sidebar

Install

npm i @infermedica/vue-sentry-plugin

Weekly Downloads

29

Version

0.1.1

License

MIT

Unpacked Size

4.74 kB

Total Files

4

Last publish

Collaborators

  • pspaczek
  • aszydelko