0.0.2 • Published 9 years ago

firewatch-client v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

Firewatch Client

firewatch = require('firewatch-client')
firewatch.connect(token).on( 'connect', function() {
  console.log('firewatch connected')
});

Installation

$ npm install firewatch-client

Schema design

Tags are indexed and fields are not indexed. This means that queries on tags are more performant than those on fields. In general, your data should guide what gets stored as a tag and what gets stored as a field:

  • Store data in tags if they’re commonly-queried meta data
  • Store data in tags if you plan to group them
  • Store data in fields if you plan to aggregate them
  • Store data in fields if you need them to be something other than a string - tag values are always interpreted as strings

Functions

post

Post stat data to server. Time is optional.

var payload = { tags : {} , values : {}, time : new Date()};
firewatch.post( seriesName, payload, function(err, response) { });

Payload can be array.

var payload = [];
var time = new Date();
payload.push( { tags : { location : "Bangkok", action : "login" } , values : { value : 1 }, time : time}  );
payload.push( { tags : { location : "Tak", action : "login" } , values : { value : 1 }, time : time}  );

firewatch.post( seriesName, payload, function(err, response) { });
postEvent

Post analytics data. Time is optional

firewatch.postEvent({ time : new Date('2011-09'), path : 'browse', event : 'view', user : {name: 'John', level : 'pro'} });
  • Every field in event data will keep as tags
aggregate

Coming soon.

0.0.2

9 years ago

0.0.1

9 years ago