When a task that retrieves data from a bucket (a) summarizes it and persists it in another bucket (b).
This is because the persistence in bucket (b) is duplicating the persistence four or five times the zeroed summarized value and the calculated value
option task = {name: "summary_hour", cron: "0 * * * *"}
from(bucket: "aggregator")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "streamer_collect")
|> map(
fn: (r) =>
({
_time: r._time,
_account_id: r._account_id,
_edge_server: r._edge_server,
_edge_bytes_transmitted: float(v: r._edge_bytes_transmitted),
}),
)
|> group(columns: ["_account_id", "_edge_server"])
|> sum(column: "_edge_bytes_transmitted")
|> map(
fn: (r) =>
({
_time: now(),
_measurement: "summary_hour",
_field: "bytes_transmitted",
_value: r._edge_bytes_transmitted,
_account_id: r._account_id,
_edge_server: r._edge_server,
_edge_bytes_transmitted: string(v: r._edge_bytes_transmitted),
}),
)
|> to(bucket: "summary_hour")