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

telemetry-node

v0.5.2

Published

SDK to access Telemetry's API

Downloads

2

Readme

Telemetry SDK for Node.js

Telemetry SDK for Node.js

This module provides connectivity between your Node project and the Telemetry data visualization service.

Installation

From npm:

npm install telemetry-node

Usage

Once installed, the module can be used by instantiating a new copy of the Telemetry.Account object:

var Telemetry = require('telemetry-node');
var account = new Telemetry.Account(apiKey, [flushTimeout], [requestUrl]);

The apiKey parameter is your API Token, while requestURL is the endpoint of the data API; if this parameter is omitted, the module points to the default API entry point automatically.

By default, the module coalesces all updates submitted to it into a single data package that is transmitted to the server every two seconds. This flushing is performed in order to minimize API usage and help to avoid running afoul of the service's rate limits.

If you prefer, you can set your own frequency by passing a different value for flushTimeout, or turn off coalescing and automatic submission by setting it to zero instead. Optionally, you can provide the module with a global callback that is run every time an update occurs:

account.flushCallback = function(err, response, body) {
    
}

The response and body parameters are populated using the HTTP response received from the server, as explained in the Telemetry API docs.

Forcing flushes

If you turn off automatic flushing, you are responsible for manually triggering flushes by calling the flush method:

account.flush([callback]);

The callback takes the same parameters as the flushCallback method above.

Sending updates

Whenever you want to send an update to a flow, you can use the update method:

account.update(flowName, newData);

The flowName parameter represents the name of the flow you wish to update, while newData is the corresponding payload. For example:

var telemetry = require('telemetry-node');

var account = new telemetry.account('yourApiKeyGoesHere');

account.update(
    'test_multivalue', 
    {
        'values' : [
        {
            'value' : Math.random() * 100000,
            'label' : 'Marco'
        },

        {
            'value' : Math.random() * 200000,
            'label' : 'Tabini'
        },

        ]
    }
);

The various data formats that are associated with each flow type are described in the API documentation. The module doesn't perform any checks against the data; instead, it simply sends everything over to the server.

Using automatic polling

If you wish, the module is capable of periodically executing one or more callbacks of your choice and using their result to issue updates to the Telemetry server. This is an easy way to integrate Telemetry in an existing project without having to strew calls to the module all over the place.

To start a poll, you use the poll method:

pollId = account.poll(flowName, interval, callback);

The flowName parameter indicates the name that will be updated with the result of the callback, while interval instructs the module to poll the data every so many milliseconds. To make handling multiple polls with a single closure easier, the callback takes, as its only parameter, the name of the flow that needs updating (which will be the same as the value of flowName on input). On output, poll() returns an identifier that can be used to stop the polling operation at a later date:

account.stopPolling(pollId)

Support

<<<<<<< Local Changes Support is provided through Telemetry's customer help interface. Simply log on to your account, select “Contact Us,” and drop us a note.======= If you prefer, you can set your own frequency by passing a different value for flushTimeout, or turn off coalescing and automatic submission by setting it to zero instead. Optionally, you can give your

telemetry_node

Node.js module for http://www.telemetryapp.com