How to use the @sentry/browser.setTag function in @sentry/browser

To help you get started, we’ve selected a few @sentry/browser 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 department-of-veterans-affairs / vets-website / src / platform / monitoring / sentry.js View on Github external
import environment from '../utilities/environment';

// url check is necessary for e2e tests and local environments
const trackErrors = environment.BASE_URL.indexOf('localhost') < 0;

if (trackErrors) {
  const url = `${environment.BASE_URL}/js-report/0`.replace('//', '//faker@');
  Sentry.init({
    dsn: url,
    ignoreErrors: [
      // Error generated by a bug in auto-fill library from safari
      // https://github.com/getsentry/sentry/issues/5267
      /Blocked a frame with origin/,
    ],
  });
  Sentry.setTag('source', 'unknown');
  Sentry.configureScope(scope => {
    scope.setLevel('error');
  });

  // this is for errors that happen in promises
  // it does not work locally with the webpack devtool setting we
  // use but does with the one we use in prod/staging
  window.addEventListener('unhandledrejection', evt => {
    Sentry.withScope(scope => {
      scope.setExtra('evt', evt);

      if (evt && evt.reason) {
        Sentry.captureException(evt.reason);
      } else {
        Sentry.captureMessage('Unhandled promise rejection');
      }
github loomnetwork / dashboard / src / index.ts View on Github external
ethereumModule.setWalletType("metamask")
    }
  },
}).$mount("#app")

// todo should store key/project elsewhere (vault?)
Sentry.init({
  dsn: process.env.NODE_ENV === "production" ? "https://7e893bd9be0942a0977eb2120b7722d4@sentry.io/1394913" : undefined,
  environment: window.location.hostname,
  integrations: [new SentryIntegrations.Vue({
    Vue,
    attachProps: true,
  })],
})

Sentry.setTag("wallet", detectedWallet())
github department-of-veterans-affairs / vets-website / src / platform / startup / index.js View on Github external
export default function startApp({
  routes,
  component,
  reducer,
  url,
  analyticsEvents,
  entryName = 'unknown',
}) {
  // Set further errors to have the appropriate source tag
  Sentry.setTag('source', entryName);

  // Set the app name for use in the apiRequest helper
  window.appName = entryName;

  const store = createCommonStore(reducer, analyticsEvents);
  connectFeatureToggle(store.dispatch);

  let history = browserHistory;
  if (url) {
    if (url.endsWith('/')) {
      throw new Error(
        'Root urls should not end with a slash. Check your manifest.json file and application entry file.',
      );
    }
    // eslint-disable-next-line react-hooks/rules-of-hooks
    history = useRouterHistory(createHistory)({
github getsentry / sentry / src / sentry / static / sentry / app / bootstrap.jsx View on Github external
new ExtraErrorData({
      // 6 is arbitrary, seems like a nice number
      depth: 6,
    }),
    new Integrations.Tracing({
      tracingOrigins: ['localhost', 'sentry.io', /^\//],
      tracesSampleRate,
    }),
  ],
});

if (window.__SENTRY__USER) {
  Sentry.setUser(window.__SENTRY__USER);
}
if (window.__SENTRY__VERSION) {
  Sentry.setTag('sentry_version', window.__SENTRY__VERSION);
}

// Used for operational metrics to determine that the application js
// bundle was loaded by browser.
metric.mark('sentry-app-init');

// setup jquery for CSRF tokens
jQuery.ajaxSetup({
  //jQuery won't allow using the ajaxCsrfSetup function directly
  beforeSend: ajaxCsrfSetup,
});

const render = Component => {
  const rootEl = document.getElementById('blk_router');

  try {
github getsentry / sentry / src / sentry / static / sentry / app / utils / apm.jsx View on Github external
export function setTransactionName(name) {
  TransactionActivity.updateTransactionName(name);
  Sentry.setTag('ui.route', name);
}