{"id":13624646,"url":"https://github.com/nodejitsu/godot","last_synced_at":"2025-04-06T20:11:48.039Z","repository":{"id":6074194,"uuid":"7300328","full_name":"nodejitsu/godot","owner":"nodejitsu","description":"Godot is a streaming real-time event processor based on Riemann written in Node.js","archived":false,"fork":false,"pushed_at":"2015-02-24T22:49:42.000Z","size":1308,"stargazers_count":265,"open_issues_count":8,"forks_count":37,"subscribers_count":26,"default_branch":"patch-branch","last_synced_at":"2024-04-26T03:02:51.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/nodejitsu/godot","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodejitsu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-24T00:19:42.000Z","updated_at":"2024-01-12T22:50:30.000Z","dependencies_parsed_at":"2022-08-27T19:51:07.902Z","dependency_job_id":null,"html_url":"https://github.com/nodejitsu/godot","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejitsu%2Fgodot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejitsu%2Fgodot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejitsu%2Fgodot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejitsu%2Fgodot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodejitsu","download_url":"https://codeload.github.com/nodejitsu/godot/tar.gz/refs/heads/patch-branch","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543593,"owners_count":20955865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:44.606Z","updated_at":"2025-04-06T20:11:48.008Z","avatar_url":"https://github.com/nodejitsu.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# godot\n\n[![build status](https://secure.travis-ci.org/nodejitsu/godot.svg?branch=patch-branch)](http://travis-ci.org/nodejitsu/godot)\n\n![](https://i.cloudup.com/zCF6jLRpLf.png)\n\nGodot is a streaming real-time event processor based on [Riemann][riemann] written in Node.js\n\n* [Usage](#usage)\n* [Events](#events)\n* [Reactors](#reactors)\n  * [Primitives](#primitives)\n* [Producers](#producers)\n* [Tests](#test)\n\n## Usage\n\nHere is a simple example of a [Reactor](#reactors) server that will send an email to `user@host.com` if the [Producer](#producer) server for `app.server` fails to send a heartbeat after 60 seconds.\n\n``` js\n  var godot = require('../lib/godot');\n\n  //\n  // Reactor server which will email `user@host.com`\n  // whenever any service matching /.*\\/health\\/heartbeat/\n  // fails to check in after 60 seconds.\n  //\n  godot.createServer({\n    //\n    // Defaults to UDP\n    //\n    type: 'udp',\n    reactors: [\n      godot.reactor()\n        .where('service', '*/health/heartbeat')\n        .expire(1000 * 60)\n        .email({ to: 'user@host.com' })\n    ]\n  }).listen(1337);\n\n  //\n  // Producer client which sends events for the service\n  // `app.server/health/heartbeat` every 15 seconds.\n  //\n  godot.createClient({\n    //\n    // Defaults to UDP\n    //\n    type: 'udp',\n    producers: [\n      godot.producer({\n        host: 'app.server.com',\n        service: 'app.server/health/heartbeat',\n        ttl: 1000 * 15\n      })\n    ],\n    //\n    // Add Reconnect logic that uses `back`\n    //\n    reconnect: {\n      retries: 2,\n      minDelay: 100,\n      maxDelay: 300\n    }\n  }).connect(1337);\n```\n\n## Events\nSimilar to [Riemann][riemann], events in `godot` are simply JSON sent over UDP or TCP. Each event has these optional fields:\n\n``` js\n  {\n    host:         \"A hostname, e.g. 'api1', 'foo.com'\"\n    service:      \"e.g. 'API port 8000 reqs/sec'\",\n    state:        \"Any string less than 255 bytes, e.g. 'ok', 'warning', 'critical'\",\n    time:         \"The time of the event, in unix epoch seconds\",\n    description:  \"Freeform text\",\n    tags:         \"Freeform list of strings, e.g. ['rate', 'fooproduct', 'transient']\",\n    meta:         \"Freeform set of key:value pairs e.g. { 'ewma': 12345 }\",\n    metric:       \"A number associated with this event, e.g. the number of reqs/sec.\",\n    ttl:          \"A floating-point time, in seconds, that this event is considered valid for.\"\n  }\n```\n\n## Reactors\nReactors in Godot are **readable and writable** [Stream][stream] instances which consume [Events](#events) and produce actions or aggregate data flow.\n\n### Primitives\n\nThere are several core Reactor primitives available in `godot` which can be composed to create more complex behavior:\n\n* `.aggregate()`: Aggregates `metric` property on events\n* `.change(key {from: x, to: y})`: Emits events when the key is changed, accepts optional `from` and `to` options for more specific changes.\n* `.email(options)`: Sends an email to the specified [options][email-options].\n* `.expire(ttl)`: Emits an event when no data is received after `ttl` milliseconds.\n* `.forward(options)`: Forwards all events to a remote server located at `options.host` and `options.port`.\n* `.sms(options)`: Sends an sms to the specified [options][sms-options].\n* `.where(key, value)|.where(filters)`: Filters events based on a single `key:value` pair or a set of `key:value` filters.\n* `.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).\n\n#### Rollup\nHere are two possible rollup examples:\n\n```js\n//\n// Rolls up 10,0000 events every 5 minute interval\n//\nvar rollup =\n  reactor()\n    .rollup(1000 * 60 * 5, 10000)\n\n//\n// Scaling Rollup, rolls up 10,000 events every 5min interval for 1 hour,\n// then rolls up 10,000 events every 30mins\n//\n\nvar scalingRollup =\n  reactor()\n    .rollup(function (period) {\n      if(period \u003c 12) {\n        return 1000 * 60 * 5;\n      }\n      return 1000 * 60 * 30;\n    }, 10000)\n```\n\n## Producers\nProducers in Godot are **readable** [Stream][stream] instances which produce [Events](#events). Events will be emitted by a given Producer every `ttl` milliseconds.\n\n## Tests\n\nAll tests are written in [vows][vows] and can be run with [npm][npm]:\n\n```\n  npm test\n```\n\n#### Copyright (C) 2012. Nodejitsu Inc.\n\n[riemann]: http://aphyr.github.com/riemann/\n[stream]: http://nodejs.org/api/stream.html\n[email-options]: https://github.com/nodejitsu/godot/tree/master/lib/godot/reactor/email.js\n[sms-options]: https://github.com/nodejitsu/godot/blob/master/lib/godot/reactor/sms.js\n[npm]: https://npmjs.org\n[vows]: http://vowsjs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejitsu%2Fgodot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodejitsu%2Fgodot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejitsu%2Fgodot/lists"}