grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
3.87k stars 475 forks source link

Custom PromQL Query function to fetch mimir results #7731

Open ska663 opened 3 months ago

ska663 commented 3 months ago

Is your feature request related to a problem? Please describe.

We need to write a custom query function to minimize/abstract the query complexities to user with simple custom query function.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Instead of writing complex queries to to find anomaly, simple anomaly function should help users. (avg_over_time(notifier_alerts{product_id="telemetry"}[1h])-avg_over_time(notifier_alerts{product_id="telemetry"}[1d]))/stddev_over_time(notifier_alerts{product_id="telemetry"}[1d])>3

Describe the solution you'd like

e.g anomaly({avg_over_time(notifier_alerts{product_id="telemetry"}[1h])})

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

dimitarvdimitrov commented 3 months ago

I'm not sure I fully understand the issue. Are you proposing adding the ability for operators to write arbitrary additional promQL functions OR to add anomaly as a promQL function in Mimir?

Either way I think Prometheus itself would be a better place to add support for this. I don't see custom promQL functions relating to the distributed nature of Mimir. In other words, if the additional promQL functions make sense for Prometheus, then they do for Mimir and vice-versa. It's easier and would benefit more people if this was added in prometheus and then trickled down the Mimir instead of patching Mimir with these changes.