0

Does anyone know how to get event aggregation to work through Square-Cube REST?

Given an event:

{
    type: 'sampleType',
    time: '...'
    data:{
        prop: 3.445
    }
}

When attempting to sum this, I am getting distinct count by item, rather than sum:

http://..:1081/1.0/metric?expression=sum(sampleType(adjClose))

[{"time":"2013-10-16T14:50:50.000Z","value":0},
{"time":"2013-10-16T14:51:00.000Z","value":0},
{"time":"2013-10-16T14:51:10.000Z","value":0},
...,
{"time":"2013-10-16T14:51:40.000Z","value":0},
{"time":"2013-10-16T14:51:50.000Z","value":0}]
deepelement
  • 2,457
  • 1
  • 25
  • 25

1 Answers1

1

You need to specify a step for your summations. For example:

http://..:1081/1.0/metric?expression=sum(sampleType(adjClose))&step=36e5

for every hour,

http://..:1081/1.0/metric?expression=sum(sampleType(adjClose))&step=864e5

for every day, and so on.

It is exponential notation for the number of milliseconds you want to sum.

You can also specify a date range. See the Cube wiki for a bit more info/examples.

wwwslinger
  • 936
  • 8
  • 14