• Stars
    star
    265
  • Rank 154,577 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Godot is a streaming real-time event processor based on Riemann written in Node.js

godot

build status

Godot is a streaming real-time event processor based on Riemann written in Node.js

Usage

Here is a simple example of a Reactor server that will send an email to [email protected] if the Producer server for app.server fails to send a heartbeat after 60 seconds.

  var godot = require('../lib/godot');

  //
  // Reactor server which will email `[email protected]`
  // whenever any service matching /.*\/health\/heartbeat/
  // fails to check in after 60 seconds.
  //
  godot.createServer({
    //
    // Defaults to UDP
    //
    type: 'udp',
    reactors: [
      godot.reactor()
        .where('service', '*/health/heartbeat')
        .expire(1000 * 60)
        .email({ to: '[email protected]' })
    ]
  }).listen(1337);

  //
  // Producer client which sends events for the service
  // `app.server/health/heartbeat` every 15 seconds.
  //
  godot.createClient({
    //
    // Defaults to UDP
    //
    type: 'udp',
    producers: [
      godot.producer({
        host: 'app.server.com',
        service: 'app.server/health/heartbeat',
        ttl: 1000 * 15
      })
    ],
    //
    // Add Reconnect logic that uses `back`
    //
    reconnect: {
      retries: 2,
      minDelay: 100,
      maxDelay: 300
    }
  }).connect(1337);

Events

Similar to Riemann, events in godot are simply JSON sent over UDP or TCP. Each event has these optional fields:

  {
    host:         "A hostname, e.g. 'api1', 'foo.com'"
    service:      "e.g. 'API port 8000 reqs/sec'",
    state:        "Any string less than 255 bytes, e.g. 'ok', 'warning', 'critical'",
    time:         "The time of the event, in unix epoch seconds",
    description:  "Freeform text",
    tags:         "Freeform list of strings, e.g. ['rate', 'fooproduct', 'transient']",
    meta:         "Freeform set of key:value pairs e.g. { 'ewma': 12345 }",
    metric:       "A number associated with this event, e.g. the number of reqs/sec.",
    ttl:          "A floating-point time, in seconds, that this event is considered valid for."
  }

Reactors

Reactors in Godot are readable and writable Stream instances which consume Events and produce actions or aggregate data flow.

Primitives

There are several core Reactor primitives available in godot which can be composed to create more complex behavior:

  • .aggregate(): Aggregates metric property on events
  • .change(key {from: x, to: y}): Emits events when the key is changed, accepts optional from and to options for more specific changes.
  • .email(options): Sends an email to the specified options.
  • .expire(ttl): Emits an event when no data is received after ttl milliseconds.
  • .forward(options): Forwards all events to a remote server located at options.host and options.port.
  • .sms(options): Sends an sms to the specified options.
  • .where(key, value)|.where(filters): Filters events based on a single key:value pair or a set of key:value filters.
  • .rollup(interval, limit)|.rollup(options): Rollup a limit amount of events to emit every interval. interval can also be a function to allow you to create varying intervals (see below).

Rollup

Here are two possible rollup examples:

//
// Rolls up 10,0000 events every 5 minute interval
//
var rollup =
  reactor()
    .rollup(1000 * 60 * 5, 10000)

//
// Scaling Rollup, rolls up 10,000 events every 5min interval for 1 hour,
// then rolls up 10,000 events every 30mins
//

var scalingRollup =
  reactor()
    .rollup(function (period) {
      if(period < 12) {
        return 1000 * 60 * 5;
      }
      return 1000 * 60 * 30;
    }, 10000)

Producers

Producers in Godot are readable Stream instances which produce Events. Events will be emitted by a given Producer every ttl milliseconds.

Tests

All tests are written in vows and can be run with npm:

  npm test

Copyright (C) 2012. Nodejitsu Inc.

More Repositories

1

haibu

[Deprecated] a node.js application server - spawn your own node.js clouds, on your own hardware
JavaScript
722
star
2

jitsu

Flawless command line deployment of your Node.js apps to the cloud
JavaScript
648
star
3

handbook

A gentle introduction to the art of Nodejitsu
JavaScript
473
star
4

nexpect

spawn and control child processes in node.js with ease
JavaScript
290
star
5

docs

Community powered rocket fuel for node.js
JavaScript
194
star
6

node-cloudservers

A client implementation for Rackspace CloudServers in node.js
JavaScript
159
star
7

require-analyzer

Determine the set of requirements for a given node.js file, directory tree, or module
JavaScript
152
star
8

node-cloudfiles

A client implementation for Rackspace CloudFIles in node.js
JavaScript
151
star
9

kohai

I am kohai. I am a pluggable irc bot for managing real-time data events.
JavaScript
91
star
10

prenup

A collaborative bdd project planning tool for node. uses kyuri and VowsJS
JavaScript
83
star
11

module-foundry

A web service for building node.js modules that runs on Linux, SmartOS and Windows.
JavaScript
80
star
12

mock-request

A simple testing tool for mocking HTTP sequences of request / response pairs in node.js
JavaScript
77
star
13

haibu-carapace

The application host used by the haibu node.js application deployment / management server.
JavaScript
69
star
14

txn

Process and update CouchDB data in atomic, all-or-nothing transactions
JavaScript
65
star
15

nodejitsu-api

a collection of client wrappers for nodejitsu's core api
JavaScript
47
star
16

browsenpm.org

Browse packages, users, code, stats and more the public npm registry in style.
JavaScript
44
star
17

forza

A lightweight agent for Godot
C
36
star
18

jitsu-ui

A terminal interface for jitsu.
JavaScript
34
star
19

aeternum

A process monitor in libuv
C
31
star
20

module-smith

A simple extensible npm build bot that works on Linux, SmartOS, and Windows.
JavaScript
19
star
21

solenoid

Jump start an application
JavaScript
19
star
22

overwatch

A deterministic couchdb replication watcher
JavaScript
19
star
23

persistent-ghost

Wrapper to deploy the Ghost blog on Nodejitsu
JavaScript
18
star
24

haibu-api

A collection of client wrappers for haibu's core api
JavaScript
11
star
25

defaultable

Transparent, drop-in helper for overridable, inheritable defaults in CommonJS modules
JavaScript
9
star
26

contour

Collection of BigPipe Pagelets for fast prototyping and scaffold of templates
CSS
8
star
27

npm-pkg-top

Lists the top binary packages by npm stars and github stars
JavaScript
7
star
28

npm-ev-source

The transform module or daemon that takes a `skimdb` based couch and turns it into an `event-sourced` complete npm
JavaScript
7
star
29

packages-pagelet

A pagelet for rendering a npm package page.
JavaScript
4
star
30

npm-package-json-pagelet

An interactive guide for package.json
HTML
3
star
31

npm-search-pagelet

Search the npm registry.
JavaScript
2
star
32

nodejitsu-npm

A simple command line utility to get started with a Nodejitsu Private npm!
JavaScript
2
star
33

npm-dependencies-pagelet

Pagelet for the dependencies UI for a single package
JavaScript
1
star
34

registry-status-pagelet

Pagelet for visual overview of npm registry statuses
JavaScript
1
star
35

service-select

Service selector pagelet for selecting
JavaScript
1
star
36

npm-documentation-pagelet

Display documentation of npm
CSS
1
star