Your event format doesn't look correct; `d` should be an object rather
than an array. You don't want square brackets.
You'll also need to make sure you have the correct indexes for the
pig_events collection, and create a pig_metrics collection. One way
you could do this would be to send a dummy pig_event to Cube's
collector, which causes it to create these collections for you (if
they don't exist already). You could then remove the dummy event
manually. But, if you don't want to recreate your existing
collections, then you'll need to look at the source to see how it's
done:
https://github.com/square/cube/blob/master/lib/cube/event.js#L64-74
Once that's done, you can issue normal queries, e.g., sum(pig) or
median(pig(value)).
I'm not sure I understand your second question. Are you asking about
the /event/get endpoint? You can specify whatever start and stop time
you like.
https://github.com/square/cube/wiki/Evaluator#wiki-event_get
Mike