Skip to content

Instantly share code, notes, and snippets.

reducer normal(mean, sigma) {
// return a Box-Muller approximate normal with given mean and stddev.
// this is written as a custom "reducer" because Box-Muller values come
// in pairs, and we want to save one for next time.
//
var leftover = null;
function update() {}
function result() {
if (leftover != null) {
var result = mean + sigma * leftover;
[
{
"time": "2015-08-03T23:20:13.000Z",
"value": 1545,
"source_type": "metric",
"name": "counters.import.success",
"import_type": "metric",
"import_space": "jut_internal",
"hostname": "ip-172-31-9-54",
"source": "service-data",
@welch
welch / gauges.import.json
Created July 15, 2015 23:14
read -space 'prod' -type 'metric' -last :5m: source~'collector*' name='gauges.import.queued'
[
{
"time": "2015-07-15T23:07:12.000Z",
"value": 0,
"source_type": "metric",
"name": "gauges.import.queued",
"host_id": "172dcec1-7238-4be6-9322-5d36599f1cbc",
"rocket_id": "4e7cf4d7-d4ec-4813-a083-c7b2a724ca5f",
"hostname": "jut-10-0-3-231",
"source": "collector-http",
@welch
welch / README.md
Created May 21, 2015 19:37
// bit-o-data: point sets for juttle demos (over in bit-o-juttle)

Bit-O-Data

Data for use in juttle examples. These are JSON arrays of points, and you get them into your juttle by sourcing their "raw" URL, eg,

source "https://gist.githubusercontent.com/welch/85872ad486a56eb9556a/raw/984b1504f7036ff548d59b2a7cb500109779869f/events.json"
@welch
welch / QQ.juttle
Last active August 29, 2015 14:21
// bit-o-juttle: juttle examples
reducer normal(mean, sigma) {
// return a Box-Muller approximate normal with given mean and stddev.
// this is written as a custom "reducer" because Box-Muller values come
// in pairs, and we want to save one for next time.
//
var leftover = null;
function update() {}
function result() {
if (leftover != null) {
var result = mean + sigma * leftover;
@welch
welch / README.md
Created May 20, 2015 23:01
// jx3 anomaly and forecasting examples

Juttle examples applying forecasting and anomaly detection to jx3 streams.

@welch
welch / pricklepants.json
Created May 11, 2015 00:15
distance Sir Charles Pricklepants runs on his wheel, from https://data.sparkfun.com/streams/MGGgb6qr39tlRVo5V8o0
[{"distanceInCm":0,"time":"2014-08-18T05:00:12.237Z"},
{"distanceInCm":0,"time":"2014-08-18T05:05:09.803Z"},
{"distanceInCm":0,"time":"2014-08-18T05:10:10.060Z"},
{"distanceInCm":0,"time":"2014-08-18T05:15:10.300Z"},
{"distanceInCm":0,"time":"2014-08-18T05:20:10.545Z"},
{"distanceInCm":0,"time":"2014-08-18T05:25:11.042Z"},
{"distanceInCm":0,"time":"2014-08-18T05:30:11.033Z"},
{"distanceInCm":0,"time":"2014-08-18T05:35:11.279Z"},
{"distanceInCm":170,"time":"2014-08-18T05:40:11.577Z"},
{"distanceInCm":0,"time":"2014-08-18T05:45:11.777Z"},
This file has been truncated, but you can view the full file.
[{"mag_x":713.66,"mag_y":-585.03,"mag_z":2321.59,"time":"2014-11-30T12:35:53.880Z"},
{"mag_x":713.03,"mag_y":-585.72,"mag_z":2321.40,"time":"2014-11-30T12:36:24.659Z"},
{"mag_x":711.83,"mag_y":-584.98,"mag_z":2317.33,"time":"2014-11-30T12:36:55.445Z"},
{"mag_x":712.82,"mag_y":-585.06,"mag_z":2318.68,"time":"2014-11-30T12:37:26.244Z"},
{"mag_x":715.49,"mag_y":-584.02,"mag_z":2322.56,"time":"2014-11-30T12:37:57.034Z"},
{"mag_x":714.46,"mag_y":-581.64,"mag_z":2317.70,"time":"2014-11-30T12:38:27.816Z"},
{"mag_x":712.50,"mag_y":-582.39,"mag_z":2314.87,"time":"2014-11-30T12:38:58.610Z"},
{"mag_x":711.84,"mag_y":-582.86,"mag_z":2313.77,"time":"2014-11-30T12:39:29.464Z"},
{"mag_x":712.57,"mag_y":-584.40,"mag_z":2314.67,"time":"2014-11-30T12:40:00.273Z"},
{"mag_x":713.13,"mag_y":-584.41,"mag_z":2316.14,"time":"2014-11-30T12:40:31.055Z"},
This file has been truncated, but you can view the full file.
[{"humidity":37.19,"irlight":0.0,"light":0.0,"pressure":30.021185563,"temp":53.24,"temp2":51.998,"uvlight":0.0,"time":"2015-03-23T16:33:57.712Z"},
{"humidity":37.2,"irlight":0.0,"light":0.0,"pressure":30.022957369,"temp":53.06,"temp2":51.98,"uvlight":0.0,"time":"2015-03-23T16:34:08.069Z"},
{"humidity":37.18,"irlight":0.0,"light":0.0,"pressure":30.019413757,"temp":53.24,"temp2":51.944,"uvlight":0.0,"time":"2015-03-23T16:34:18.389Z"},
{"humidity":37.18,"irlight":0.0,"light":0.0,"pressure":30.020594961,"temp":53.24,"temp2":51.962,"uvlight":0.0,"time":"2015-03-23T16:34:28.973Z"},
{"humidity":37.16,"irlight":0.0,"light":0.0,"pressure":30.021776165,"temp":53.24,"temp2":51.926,"uvlight":0.0,"time":"2015-03-23T16:34:39.467Z"},
{"humidity":37.17,"irlight":0.0,"light":0.0,"pressure":30.022071466,"temp":53.24,"temp2":51.98,"uvlight":0.0,"time":"2015-03-23T16:34:49.783Z"},
{"humidity":37.17,"irlight":0.0,"light":0.0,"pressure":30.02325267,"temp":53.24,"temp2":51.944,"uvlight":0.0,"time":"2015-03-23T16:35:00.093Z"},
{"hum
@welch
welch / events.json
Last active August 29, 2015 14:20
mixed stream of purchases and customer info
[
{"time":"2015-01-01T00:00:00.000Z", "event":"create", "cust_id":1, "email":"lou@grainger.com"},
{"time":"2015-01-01T00:00:01.000Z", "event":"create", "cust_id":2, "email":"bubba@nytimes.com"},
{"time":"2015-01-01T00:00:02.000Z", "event":"purchase", "cust_id":1, "purchase_id":1},
{"time":"2015-01-01T00:00:03.000Z", "event":"purchase", "cust_id":2, "purchase_id":2},
{"time":"2015-01-01T00:00:04.000Z", "event":"purchase", "cust_id":1, "purchase_id":3},
{"time":"2015-01-01T00:00:05.000Z", "event":"update", "cust_id":1, "email":"louise@grainger.com"},
{"time":"2015-01-01T00:00:06.000Z", "event":"purchase", "cust_id":1, "purchase_id":4},
{"time":"2015-01-01T00:00:07.000Z", "event":"update", "cust_id":1, "email":"larry@grainger.com"},
{"time":"2015-01-01T00:00:08.000Z", "event":"purchase", "cust_id":2, "purchase_id":5},