Skip to content

Instantly share code, notes, and snippets.

@juttle
juttle / README.md
Created November 15, 2014 01:42
Custom Reducers Dev

There's a reducer for that...

What query language hasn't left you wanting of just a few more functions? The Juttle dataflow language comes with powerful built-in functions like percentile() but you can define your own functions or reducers that operate on every point in a stream or on batches of points. You can also import functions that other people have written.

In this example, we implement an exponentially weighted moving average function and import a derivative function.

Your Turn:

  • Try changing the weight used in the ewma function by changing .9 to .1 on line 16.
  • On line 7, we've imported a derivative reducer. Let's see what it does by uncommenting line 17, then adding "der" to the list of columns in the timechart.
@juttle
juttle / README.md
Created November 15, 2014 01:43
Split and Join Flowgraphs Dev

Split and Join Flowgraphs

Juttle programs enable you to answer questions in dynamic, changing environments by letting you split a stream of data, run different computations on each stream, and then join the two streams together again. These dynamic programs continually update their results, allowing you to follow hotspots around your environment or use one program output as a key for others.

This example finds the slowest host in the "search" service based on response time, every 10 seconds, and then gets a count of user requests running on that particular host.

Your Turn:

  • Try changing the service from "search" to "index".
  • Let's make sure we are in fact getting showing the slowest host:
  • Uncomment line 21