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

@yamadayuki/nodejs

v0.0.14-alpha.5

Published

OpenCensus is a toolkit for collecting application performance and behavior data.

Downloads

4

Readme

OpenCensus for Node.js

Gitter chat

OpenCensus Node.js is an implementation of OpenCensus, a toolkit for collecting application performance and behavior monitoring data.

The library is in alpha stage and the API is subject to change.

Please join gitter for help or feedback on this project.

Installation

Install OpenCensus with:

npm install @yamadayuki/nodejs

Traces

Instrumenting an Application

OpenCensus for Node.js has automatic instrumentation out of the box for those modules:

This means that spans are automatically created for operations of those packages. To use it, simply start the tracing instance.

const tracing = require('@yamadayuki/nodejs');
tracing.start();

Similarly for Typescript:

import * as tracing from '@yamadayuki/nodejs';
tracing.start();

Manually Instrument an Application

In addition to automatic tracing, it is possible to manually create your own root and child spans.

const rootSpanOptions = { name: 'your root span' };
tracing.tracer.startRootSpan(rootSpanOptions, (rootSpan) => {

    // You can create as many child spans as needed
    childSpan = tracing.tracer.startChildSpan({
        name: 'name of your child span'
    });
    // Do some operation...
    // Finish the child span at the end of it's operation
    childSpan.end();

    // Finish the root span at the end of the operation
    rootSpan.end();
});

For manual only instrumentation see the @yamadayuki/nodejs-base package.

Tracing Options

Tracing has many options available to choose from. At tracing.start(), you can set the following:

| Options | Type | Description | | ------- | ---- | ----------- | | defaultAttributes | Attributes | Default attributes added to every span created by the tracer | | bufferSize | number | The number of traces to be collected before exporting to a backend | | bufferTimeout | number | Maximum time to wait before exporting to a backend | | logger | Logger | A logger object | | logLevel | number | Level of logger - 0: disable, 1: error, 2: warn, 3: info, 4: debug | | samplingRate | number | Determines the span's sampling rate. Ranges from 0.0 to 1.0 | | propagation | Propagation | A propagation instance to use | | maximumLabelValueSize | number | The maximum number of characters reported on a label value | | plugins | PluginNames | A list of trace instrumentations plugins to load | | exporter | Exporter | An exporter object |

Plugins

OpenCensus can collect tracing data automatically using plugins. Users can also create and use their own plugins. Currently, OpenCensus supports automatic tracing for:

Propagation

OpenCensus collects distributed tracing. It is able to do so by propagating span data through services. Currently, OpenCensus supports:

Exporters

OpenCensus can export trace data to various backends. Currently, OpenCensus supports:

If no exporter is registered in the tracing instance, as default, a console log exporter is used.

Useful links