Skip to content

Update mimir-prom to v1.8.2-0.20250423083340-007de9b763aa#11292

Merged
zenador merged 9 commits intomainfrom
zenador/sync-mimir-prom
Apr 25, 2025
Merged

Update mimir-prom to v1.8.2-0.20250423083340-007de9b763aa#11292
zenador merged 9 commits intomainfrom
zenador/sync-mimir-prom

Conversation

@zenador
Copy link
Copy Markdown
Contributor

@zenador zenador commented Apr 23, 2025

What this PR does

This updates mimir-prom to grafana/mimir-prometheus#867

Which issue(s) this PR fixes or relates to

N/A

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.

@zenador zenador requested review from a team and stevesg as code owners April 23, 2025 17:10
56quarters and others added 5 commits April 23, 2025 15:57
Copy link
Copy Markdown
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

do you know if we now support duration arithmetic? Do we not support it explicitly?

expr, err = promql.PreprocessExpr(expr, timestamp.Time(r.GetStart()), timestamp.Time(r.GetEnd()))
if err != nil {
// We are being pessimistic in such cases.
level.Warn(logger).Log("msg", "failed to preprocess query, considering @ modifier as not cachable", "query", query, "err", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we return a reason here? now we're getting double logging with this line

level.Debug(spanLog).Log("msg", "skipping response cache as query is not cacheable", "query", splitReq.orig.GetQuery(), "reason", reason, "tenants", tenant.JoinTenantIDs(tenantIDs))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Isn't that the same behaviour (different log msg) we already had in this though?

	expr, err := parser.ParseExpr(query)
	if err != nil {
		// We are being pessimistic in such cases.
		level.Warn(logger).Log("msg", "failed to parse query, considering @ modifier as not cachable", "query", query, "err", err)
		return false
	}

Or should we change both of those to return unique errors and remove the log line?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, i didn't see this before. I'd prefer if we return a reason so we don't double log the same error. But i understand if you consider this out of scope

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Happy to fix that in a separate PR!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

},
},
},
"floats: 0 length range": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are these removed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@charleskorn added these because he found an edge case in promql while working on MQE and added them to Prometheus upstream and MQE. The equivalent tests upstream (Prometheus) were removed when duration arithmetic support was added which we are now pulling in.

Copy link
Copy Markdown
Contributor Author

@zenador zenador Apr 24, 2025

Choose a reason for hiding this comment

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

Zero durations are no longer allowed in PromQL with prometheus/prometheus#16249 whoops Github didn't show me that Nick already replied

@56quarters
Copy link
Copy Markdown
Contributor

do you know if we now support duration arithmetic? Do we not support it explicitly?

There's a global flag that needs to be set to enable it (same as experimental functions). We don't set it currently and I didn't want to just blindly enable it during a Prometheus update without talking with the team. I think we don't need to do anything to support it since it's entirely in the upstream PromQL parser which we use even in MQE.

@zenador
Copy link
Copy Markdown
Contributor Author

zenador commented Apr 24, 2025

@krajorama asked about that in slack (not sure if I should stick the link here), it seems we're planning to enable it by default for now, but we were planning to do that in a separate PR with a proper changelog as it's cleaner. Right now it's not enabled, but some of the validation behaviour has changed anyway (returning different errors, tests have been updated accordingly).

Copy link
Copy Markdown
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

thanks for explaining @56quarters @zenador

@dimitarvdimitrov
Copy link
Copy Markdown
Contributor

do you know if we now support duration arithmetic? Do we not support it explicitly?

There's a global flag that needs to be set to enable it (same as experimental functions). We don't set it currently and I didn't want to just blindly enable it during a Prometheus update without talking with the team. I think we don't need to do anything to support it since it's entirely in the upstream PromQL parser which we use even in MQE.

I was more concerned about Mimir crashing or panicking if its gets a request with arithmetic

@zenador zenador merged commit bd39677 into main Apr 25, 2025
26 checks passed
@zenador zenador deleted the zenador/sync-mimir-prom branch April 25, 2025 09:38
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.

3 participants