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

@iantocristian/good-sentry

v2.6.1

Published

Sentry broadcasting for good process monitor

Downloads

9

Readme

good-sentry

Sentry broadcasting for good process monitor.

good-sentry is a write stream used to send hapi server events to a Sentry server.

Current Version Build Status License

Donate

Usage

new GoodSentry ([options])

Creates a new GoodSentry object with the following arguments:

  • [options] - optional configuration object with the following keys
    • [dsn] - Sentry project's Data Source Name. Defaults to null but expects SENTRY_DSN environment variable to be set.
    • [config] - optional configuration object with the following keys
      • [name] - The name of the logger used by Sentry. Defaults to hostname. Optionally set the name using SENTRY_NAME environment variable.
      • [logger] - The name of the Sentry client. Defaults to ''.
      • [release] - The version/release of your application. Defaults to ''. Optionally set the release using SENTRY_RELEASE environment variable.
      • [environment] - The environment name of your application. Defaults to ''. Optionally set the environment using SENTRY_ENVIRONMENT environment variable.
    • [captureUncaught] - Enable global error handling. Defaults to false.

Tags

Because Hapi tags are an array of strings and Sentry expects tags to be a k/v map, good-sentry sets all tags associated with an event to tag: true pairs. Those are nicely displayed in the tags section of Sentry web interface:

Tags in Sentry

Example Usage

const Hapi = require('hapi');
const version = require('package.json').version;
const server = new Hapi.Server();
server.connection();

const options = {
  reporters: {
    mySentryReporter: [{
      module: 'good-squeeze',
      name: 'Squeeze',
      args: [{ log: '*' }],
    }, {
      module: 'good-sentry',
      args: [ {
        dsn: 'https://<key>:<secret>@sentry.io/<project>',
        config: {
          name: 'myAwesomeHapiServer',
          logger: 'mySentryReporter',
          release: version,
          environment: process.env.NODE_ENV,
        },
        captureUncaught: true,
      }],
    }],
  },
};

server.register({
    register: require('good'),
    options,
}, (err) => {
  server.start(() => {
    server.log([], 'Sample debug event.');
    server.log(['debug'], 'Sample tagged debug event.');
    server.log(['info'], 'Sample info event.');
    server.log(['warning', 'server'], 'Sample warning event with tags.');
    server.log(['error', 'first-tag', 'second-tag'], 'Sample error event with tags.');
    
    // Throw an error after 5 seconds
    setTimeout(() => {
      throw new Error('An uncaught error');
    }, 5000);
  });
});

This example sets up the reporter named mySentryReporter to listen for server events and send them to a Sentry project with additional settings.

License

Released under the MIT license.