Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented May 2, 2025

This change adds support for min_over_time in time-series data streams. Similar to max_over_time, min_over_time is translated to compute the min per time-series first.

For example:

TS my-metrics 
| STATS SUM(min_over_time(memory_usage)) BY cluster, bucket(@timestamp, 1 minute)

is translated into:

TS my-metrics 
| STATS min_memory_usage=min(memory_usage), cluster=VALUES(cluster) BY _tsid, ts=bucket(@timestamp, 1 minute) 
| STATS sum(min_memory_usage) BY cluster, ts

@dnhatn dnhatn added :StorageEngine/TSDB You know, for Metrics >non-issue labels May 2, 2025
@dnhatn dnhatn requested review from kkrik-es and limotova May 2, 2025 17:25
@dnhatn dnhatn marked this pull request as ready for review May 2, 2025 17:25
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Contributor

@limotova limotova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thank you!

@dnhatn
Copy link
Member Author

dnhatn commented May 2, 2025

Thanks Larisa!

@dnhatn dnhatn merged commit c38338e into elastic:main May 2, 2025
17 checks passed
@dnhatn dnhatn deleted the min-over-time branch May 2, 2025 18:18
Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request May 12, 2025
This change adds support for `min_over_time` in time-series data 
streams. Similar to `max_over_time`, `min_over_time` is translated to
compute the min per time-series first.

For example:

```
TS my-metrics
| STATS SUM(min_over_time(memory_usage)) BY cluster, bucket(@timestamp, 1 minute)
```

is translated into:

```
TS my-metrics
| STATS min_memory_usage=min(memory_usage), cluster=VALUES(cluster) BY _tsid, ts=bucket(@timestamp, 1 minute)
| STATS sum(min_memory_usage) BY cluster, ts
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants