Skip to content

Instantly share code, notes, and snippets.

@hamiltop
Created August 12, 2014 21:53
Show Gist options
  • Save hamiltop/0fc3dd68825536a06a24 to your computer and use it in GitHub Desktop.
Save hamiltop/0fc3dd68825536a06a24 to your computer and use it in GitHub Desktop.
Snippet of Elixir
Stream.interval(1000)
|> Stream.map fn(_) -> get_memory_usage end
|> Stream.chunk(60) # group every 60 seconds together
|> Stream.map &( {Enum.min(&1), Enum.max(&1)} )
|> Enum.each fn ({min, max) ->
send_to_graphite("min_memory_usage", min)
send_to_graphite("max_memory_usage", max)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment