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

v1.1.1

Published

A Raygun.io integration via Ember.js addon.

Downloads

7

Readme

ember-raygun

A Raygun.io integration via an addon. Uses v2 of the Raygun JS API, rg4js.

Build Status

To enable and set your API Key add to config/environment:

'use strict';

module.exports = function(environment/*, appConfig */) {
  return {
    raygun: {
      apiKey: 'APP_API_KEY_HERE',
      enabled: true,
      enableCrashReporting: false,
      enableUserTracking: true,
      enablePulse: true,
      saveIfOffline: true,
      sensitiveData: ['password'],
      tags: [ environment ]
    }
  };
};

The config also supports using a string.

  • e.g. enablePulse: "#{raygun:enablePulse}",

This may be useful if you use replace config settings during deployment instead of only during the ember build.

User tracking

Personally identifiable info (PII) should never be sent to Raygun, without legal approval.

The enableUserTracking setting will disable the Raygun anonymous tracking and utilize a custom user id value (uuid) to track users. When using this update the user id once your user logs into your application. The raygun service provides a setUser method.

Example Implementation

Your implemenation depends on your application's needs, the raygun service, provided by this addon can be used to manage the tracked user.

See the tests/dummy application as an example of managing an user id, with anonymous id or an actual user id provided after login.

The config for a development build uses environment variables.

  • export RAYGUN_ENABLED=true; export RAYGUN_CRASH_REPORTING=false; export RAYGUN_USER_TRACKING=true; export RAYGUN_API_KEY='X'; ember s
  • visit http://localhost:4200/login

On Windows you can use PowerShell to set an environment variable, $env:RAYGUN_ENABLED="true"

To prevent certain errors from Raygun Crash Reporting, use a utility function in your app named raygun-error-filter.

  • ember generate util raygun-error-filter

Perhaps your app handles RSVP errors caught from XHR requests, based status codes, 401, 403, and 409. And the related errors shoud not be reported to Raygun.

Below is an example utility function that you may use as a filter.

export default function raygunErrorFilter(error) {
  if (error && error.xhr && error.xhr.status && [401,403,409].includes(error.xhr.status)) {
    return null;
  } else {
    return error;
  }
}

If the utility function returns the error passed in, then it will be reported. To ensure the filter function is used with window.onerror (uncaught errors) set the config value for enableCrashReporting to false. A true setting would use Raygun's automatic setup for winodow.onerror, which doesn't filter.

See the dummy app example, utils/raygun-error-filter.

Crash reporting is generated through Ember.onerror, RSVP.on('error', () => {}), Ember.Logger.error, and window.onerror. When your application's config enables Raygun Crash reporting, this behavior is setup using an instance initializer.

If you would like to define how your app reports runtime errors to Raygun, then you may generate your own instance initializer.

  • ember generate instance-initializer raygun

See addon/instance-initializers/raygun.

Installation

  • ember install ember-raygun

Running Tests

  • npm test (Runs ember try:each to test multiple Ember versions)
  • ember test
  • ember test --server

For more information on using ember-cli, visit https://ember-cli.com/.