Skip to content

Conversation

lamida
Copy link
Contributor

@lamida lamida commented Mar 10, 2025

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.

@lamida lamida requested a review from a team as a code owner March 10, 2025 07:51
unsupportedExpressions := map[string]string{
"absent_over_time(nonexistent{}[1h])": "'absent_over_time' function",
}
unsupportedExpressions := map[string]string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add holt_winters here until we add support for that? Or perhaps an experimental function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in d646f61. Let me know if something is incorrect there.

Comment on lines 73 to 77
for {
step, err := a.inner.NextStepSamples()
// nolint:errorlint // errors.Is introduces a performance overhead, and NextStepSamples is guaranteed to return exactly EOS, never a wrapped error.
if err == types.EOS {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

We could simplify this slightly by changing the for to something like for stepIdx := range a.timeRange.StepCount. We can then drop the special check for err == types.EOS (we should never receive an EOS for any of the steps, and if we do, we should return an error) and line 82 then doesn't need to call PointIndex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in dcd5239


var err error
for step := range a.timeRange.StepCount {
t := a.timeRange.IndexTime(int64(step))
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] We only need to call IndexTime if we're going to emit a sample for this step, so this could move down beneath the if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved in b992055

Comment on lines 21 to 27
timeRange types.QueryTimeRange
argExpressions parser.Expr
inner types.RangeVectorOperator
expressionPosition posrange.PositionRange
memoryConsumptionTracker *limiting.MemoryConsumptionTracker
presence []bool
exhausted bool
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] We usually export some of these - could you please make this consistent with the other operators? The usual rule of thumb is that internal implementation details aren't exported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 4726cdd

@charleskorn
Copy link
Contributor

Could you please also add this to #10067?

@lamida lamida changed the title Implement absent_over_time MQE: Implement absent_over_time Mar 11, 2025
@lamida lamida mentioned this pull request Mar 11, 2025
@lamida lamida requested a review from charleskorn March 11, 2025 07:56
@lamida
Copy link
Contributor Author

lamida commented Mar 11, 2025

@charleskorn all of your PR feedbacks has already been addressed. Please take another look. I am also still checking the failure in test with out of order sample error. Update: The error should already be fixed by now.

// expected error for holt_winters is the same as double_exponential_smoothing because mimir just aliasing it as above
"holt_winters(metric{}[1h], 1, 1)": "'double_exponential_smoothing' function",

"double_exponential_smoothing(metric{}[1h], 1, 1)": "'double_exponential_smoothing' function",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think adding just double_exponential_smoothing here is sufficient - no need to add holt_winters (and the aliasing above) as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 54f36f4

lamida and others added 17 commits March 12, 2025 11:50
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
@lamida lamida force-pushed the lamida/mqe-absent-over-time2 branch from f48e01e to 54f36f4 Compare March 12, 2025 03:51
@lamida lamida merged commit 025eb57 into main Mar 12, 2025
28 checks passed
@lamida lamida deleted the lamida/mqe-absent-over-time2 branch March 12, 2025 04:28
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