I hereby claim:
- I am terrhorn on github.
- I am terrhorn (https://keybase.io/terrhorn) on keybase.
- I have a public key whose fingerprint is DD56 9F81 4C96 C469 082E F882 3FF5 8ABD DDFB BAC5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
val collectionName = "my_event_collection" // the name of your collection | |
val events = ArrayBuffer.empty[String] // an array buffer to hold all of the events that we'll batch | |
// populate the array with 5000 fake events | |
for(i <- 1 to 5000) { | |
events.append(s"""{"foo": { "count": $i, "bar": "baz"} }""") | |
} | |
// split events into 5 batches of 1000 events, and send each batch to Keen | |
for(batch <- events.grouped(1000)) { |
require 'dotenv' | |
require 'keen' | |
Dotenv.load | |
# allow timeframe to be specified via the command line | |
# usage: ruby collection_counts.rb previous_7_days | |
if !ARGV[0].nil? | |
timeframe = ARGV[0] | |
end |