Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQE: Add support for count aggregation #9342

Merged
merged 9 commits into from
Sep 20, 2024

Conversation

jhesketh
Copy link
Contributor

@jhesketh jhesketh commented Sep 20, 2024

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@jhesketh jhesketh requested a review from a team as a code owner September 20, 2024 01:55
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

Overall LGTM 🚀

pkg/streamingpromql/aggregations/count.go Outdated Show resolved Hide resolved
pkg/streamingpromql/aggregations/count.go Outdated Show resolved Hide resolved
}

for _, p := range data.Floats {
idx := (p.T - timeRange.StartT) / timeRange.IntervalMs
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be something for a follow up PR, but we have expressions like this in lots of places - what do you think about adding this calculation as a helper method on QueryTimeRange?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, will add it later


for i, havePoint := range g.floatPresent {
if havePoint {
t := timeRange.StartT + int64(i)*timeRange.IntervalMs
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar suggestion to above, similarly could be a separate PR: we could add a method to QueryTimeRange to do this calculation.

@jhesketh jhesketh enabled auto-merge (squash) September 20, 2024 02:16
@jhesketh jhesketh force-pushed the jhesketh/mqe-aggregations-count branch from 2dad30d to 2f0c7de Compare September 20, 2024 02:36
@jhesketh jhesketh merged commit 9febb6a into grafana:main Sep 20, 2024
29 checks passed
@jhesketh jhesketh deleted the jhesketh/mqe-aggregations-count branch September 20, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants