influxdata / influxdata/influxdb3_plugins

request: Add moving average calculation type to downsampling plugin

Open
#41 2 comments 0 reactions 1 assignee View on GitHub

@caterryan is already working on this.

Since Feb 2, 2026.

enhancement
Dominant language
Python
Stars
37
Forks
24
Avg merge
16h 16m
Merged PRs (30d)
17

Description

# Add moving average calculation type to downsampling plugin

### Description:

Add support for a moving average calculation type in the downsampling plugin. This would allow users to compute rolling/sliding window averages over a configurable number of preceding rows.

### Example use case:

```
SELECT
time,
site_id,
AVG(metric_value) OVER (
PARTITION BY metric_name, site, region, zone, site_id, group_id
ORDER BY time
ROWS BETWEEN 4 PRECEDING AND CURRENT ROW
) AS 5_sec_moving_avg
FROM measurements
WHERE
$__timeFilter(time)
AND group_id IN (${group_id:singlequote})
AND asset_id LIKE (${asset_id:singlequote})
ORDER BY time ASC

```

## Requirements:

- New moving_avg calculation type alongside existing types (e.g. mean, sum, min, max)
- Configurable window size (number of preceding rows)
- Support for partition-by grouping on tag columns
- Results ordered by time

## Configuration example:

[[calculations]]
type = "moving_avg"
window_size = 5
field = "metric_value"
partition_by = ["metric_name", "site", "region", "zone"]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.