Don't understand the 2 aggregators in singlestat panel

This is a singlestat panel for OpenTSDB datasource:

Here is my requirement: on this metric I would like to sum all data within every 10m, and only show the value of last 5m ago, which display “the latest alive requests count”. However the combinations of the 2 aggregators (as shown above) don’t make sense to me, the yield value is not right?

Here is one example:

if I select “sum” in both aggregators, the respond json will look like:

dps:{1496976300: 3975, 1496976900: 4576},
aggregator: “sum”,
downsample: “5m-sum”

However the singlestat panel shows an average number of 4276? (= (3975+4576)/2 )

And if I select “last” in the 1st line, the response is:

dps: {1496976300: 76, 1496976900: 126},

But the panel shows “101” (= (76 + 126) / 2)

Just wondering how can I show the last 5 minutes sum in the panel?

In the options tab there is an option for what Stat to show, sum, total, last etc

Thanks! just find it in options tab. But it brings me another question that: for singlestat panel, there are at least 3 aggregators configurable:

agg1. metric’s aggregator (e.g. the 1st line in the pic above)
agg2. downsample’s aggregator (2nd line in pic)
agg3. options’ aggregator as you mentioned.

My understanding is that: the raw datasets are firstly grouped within down sample (e.g. every 5 mins) and aggregated via agg2 to yield v0, v5, v10, v15, … But I’m not sure which aggregator (1 or 3?) do we use to continue processing v0 ~v15? Seems in singlestat agg3 is used, but what’s the usage of agg1?

for agg1 & agg2 you think the OpenTSDB docs should provide the answer to how the metric and downsample aggregators work.