npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-bugsnag

v3.0.2

Published

Integrates Bugsnag reporting service into your Ember CLI app.

Downloads

483

Readme

Ember-cli-bugsnag

Build Status Ember Observer Score

Installation

Install the addon:

ember install ember-cli-bugsnag

💥 ember-cli-bugsnag 3.0.0 includes some breaking changes. Learn more.

Configuration

There are two ways to configure ember-cli-bugsnag:

  1. Add POJO to config/environment:
{
  bugsnag: {
    apiKey: '',
    enabledReleaseStages: ['development', 'production']
  }
}

The releaseStage defaults to the current application environment, if you need to set a different releaseStage that diverges from the environment, you can pass and additional attribute to the bugsnag configuration called releaseStage. It would look like this:

{
  bugsnag: {
    apiKey: '',
    enabledReleaseStages: ['development', 'production', 'staging'],
    releaseStage: 'staging'
  }
}
  1. Specify environment variables:
export BUGSNAG_API_KEY=''
export BUGSNAG_ENABLED_RELEASE='development,production'

Configuration options:

  • config.bugsnag.apiKey / BUGSNAG_API_KEY -- required
  • config.bugsnag.enabledReleaseStages / BUGSNAG_ENABLED_RELEASE -- optional, defaults to [] (never notify).
  • config.bugsnag.releaseStage / BUGSNAG_RELEASE_STAGE -- optional, defaults to config.environment.
  • config.bugsnag.endpoints / BUGSNAG_ENDPOINTS -- optional, defaults to what the libraryUrl uses.
  • config.currentRevision -- any string representing the current version of the app, e.g. "1b8ef2c7" or "v1.2.4", optional.
    • Defaults to the version specified in package.json, e.g. 0.1.0.
    • This can be set automatically at build time with ember-git-version.

Customization

In order to send additional data along with errors reported to Bugsnag, generate a utility named bugsnag:

ember g util bugsnag

Custom Diagnostics (docs)

To send custom metadata, define a helper method getMetadata in the app/utils/bugsnag.js you created. getMetadata takes the error and the container as arguments, e.g.:

export function getMetadata(error, container) {
  return {
    // …some metadata
  };
}

ember-cli-bugsnag calls this method for every error and reports any data returned by it to Bugsnag as metadata for the respective error. The returned metadata should be formatted to correspond with tabs in your interface. E.g. for an Account tab:

return {
  account: {
    name: "Bugsnag",
    plan: "premium",
    beta_access: true
  }
};

Identifying Users (docs)

To correlate a specific user to an error and have the information appear in the User tab in the Bugsnag UI, send user data with each error data. Define a helper method getUser in the app/utils/bugsnag.js you created. getUser takes the container as an argument. For example, if you have a currentUser service that references a user model in your app:

import Ember from 'ember';

const {
  getProperties
} = Ember;

export function getUser(owner) {
  const currentUser = owner.lookup('service:current-user').get('user');
  const {
    email,
    id,
    fullName: name
  } = getProperties(currentUser, 'email', 'id', 'fullName');

  return {
    email,
    id,
    name
  };
}

Uploading Sourcemaps (docs)

Uploading sourcemaps to Bugsnag makes it easier to track down errors in your code because the stacktrace for each error in the Bugsnag UI highlights the exact line in your unminified source code. To send sourcemaps to Bugsnag, you can use the Ember CLI Deploy addon ember-cli-deploy-bugsnag.

Upgrading to 3.0

ember-cli-bugsnag 3.0 includes some changes to bring this addon in line with the latest from the bugsnag-js library and accompanying documentation.

  1. Rename config.bugsnag.notifyReleaseStages/BUGSNAG_NOTIFY_RELEASE to config.bugsnag.enabledReleaseStages/BUGSNAG_ENABLED_RELEASE

  2. config.bugsnag.endpoint/ BUGSNAG_ENDPOINT => config.bugsnag.endpoints/BUGSNAG_ENDPOINTS

  3. Rename getMetaData => getMetadata in app/utils/bugsnag.js