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-rollbar2

v0.9.0

Published

Drop in Rollbar reporting for Ember ClI.

Downloads

89

Readme

ember-cli-rollbar2

Seamless, automatic Rollbar integration for Ember and Fastboot apps

Build Status Maintainability Dependency Status npm version Greenkeeper badge

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

Install as a standard Ember Addon:

  • ember install ember-cli-rollbar2

Usage

In your config/environment.js file:

let ENV = {
  rollbar: {
    // Rollbar configuration goes here
    accessToken: 'POST_CLIENT_ITEM_ACCESS_TOKEN'
  },
  'ember-cli-rollbar': {
    // Addon configuration goes here

  }
};

Configuration

Rollbar library

The Rollbar Configuration is specified in the rollbar key in the environment. See the Rollbar documentation for available options.

If enabled is not set, this addon will automatically enable Rollbar if the Ember environment is production.

Addon options

  • captureEmberErrors: Defaults to true. The addon can set Ember.onerror to capture errors sent by Ember.
  • outputEmberErrorsToConsole: Defaults to true. When catching Ember errors, it also writes these errors to the console. If you prefer to not have your errors logged to the console, set this to false.

Rollbar service

This adds a rollbar service to your app which exposes the Rollbar client library to your application. You can use this service to log messages explicitly in outside of exceptions or Ember.Logger overrides:

  import Controller from '@ember/controller';
  import { inject as service } from '@ember/service';
  
  export default Controller.extend({
    rollbar: service(),
  
    actions: {
      doSomething() {
        try {
          somethingThatMightFail();
        } catch (err) {
          this.get('rollbar').error('Caught an exception', err);
        }
      }
    }
  });

The service directly exposes the methods log, debug, info, warn, warning, error, critical, and setPerson. The Rollbar client instance itself can be accessed via the instance property. The setPerson method configures Rollbar for Person tracking and should be called with a hash (or id) that represents the current user.

FastBoot Support

FastBoot support is mostly automatic, however there some changes you will need to make to your project:

  1. In package.json, move the rollbar package from devDependencies to dependencies.
  2. Also in package.json, add rollbar to your fastbootDependencies:
  "fastbootDependencies": [
    "rollbar"
  ]

In addition, when in FastBoot mode, the Rollbar Node library cannot use the Rollbar client token, it must use a server token to access its API.

There are two ways to provide this token, in the section below.

Rollbar Access Token Configuration in FastBoot

You may choose to set Rollbar's POST_SERVER_ITEM_ACCESS_TOKEN directly in the addon configuration:

let ENV = {
  'ember-cli-rollbar': {
    serverToken: 'POST_SERVER_ITEM_ACCESS_TOKEN'
  }
};

The downside of using serverToken is that the server token is then leaked into the client configuration and visible in the browser. If you don't want that, you can add it to a process environment variable which the addon will read:

let ENV = {
  'ember-cli-rollbar': {
    serverTokenEnv: 'MY_TOKEN_ENV_VAR'
  }
};

In this case, the addon will use value of the MY_TOKEN_ENV_VAR environment variable in the FastBoot process as the server token. In addition, in order to use this you will need to add process to your list of fastbootDependencies:

  "fastbootDependencies": [
    "process",
    "rollbar"
  ]

Contributing

See the Contributing guide for details.