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

@bonniernews/datadawg

v3.1.0

Published

Simple configuration management

Downloads

33

Readme

Datadawg - Simplify Your Datadog Integration

Datadawg is a user-friendly library that simplifies the integration of Datadog (dd-trace library) with your application. We've built an easy-to-use configuration wrapper and exported some of the functions we use, making it simple for developers to add custom tracking to their applications, monitor tasks, and report errors with different spans.

Features

  • Easy-to-use configuration wrapper for Datadog integration
  • Custom tracking of application logs
  • Task monitoring
  • Error reporting with different spans
  • United configuration for use across multiple repositories

Getting Started

To get started with Datadawg, simply install the package via npm:

npm install @bonniernews/datadawg

Next, require datadawg in your application:

const datadawg = require('@bonniernews/datadawg').init({
    repositoryUrl: 'github repository url',
    sourceVersion: 'github hash'
})

From there, you can begin using Datadawg's various features to track your application's metrics, monitor tasks, and report errors.

Examples

Here are a few examples of how to use Datadawg in your application:

Tracking Application Logs

According to Datadogs documentation here.

const datadawg = require('@bonniernews/datadawg')

datadawg.trace('Trace name', {resource: 'resource name'}, async () => { 
    // Your code
})

Notify error

const datadawg = require('@bonniernews/datadawg')

const error = new Error('something went wrong');

datadawg.noticeError(error)

// notice error with custom attributes
datadawg.noticeError(error, { customAttribute: 'test' })

Add trace attribute

Adding attributes to a span with addSpan makes it viewable in the Datadog UI, however, it is not searchable if your Datadog instance it not setup to index all spans which it rarely is. To add custom attributes which are searchable, use the addRootSpan function. This will add attributes to the root span which is more likely to be indexed and is therefore searchable.

To add custom attributes to the current span, use the addSpan function.

const datadawg = require('@bonniernews/datadawg')

datadawg.addSpan({ customAttribute: 'test' })

To add custom attributes to the root span, use the addRootSpan function.

const datadawg = require('@bonniernews/datadawg')

datadawg.addRootSpan({ customAttribute: 'test' })

License

This library is licensed under the MIT License.