我试图让我的查询在grafana中对间隔进行求和,但我得到了以下错误:
"query processing would load too many samples into memory in query execution"
如果我每天隔一段时间看过去的30天。
我有一个名为intrvl
的变量,其时间间隔为1m, 1h, 12h, 24h, and 30d
,我的查询如下所示:
sort_desc(
sum by (backend)(sum_over_time(haproxy_backend_http_responses_total{code=~"[1,2,3,4][x][x]",tags=~".*external.*"}[$intrvl]))
/
sum by (backend)(sum_over_time(haproxy_backend_http_responses_total{code!~"\\b(\\w*other\\w*)\\b",tags=~".*external.*"}[$intrvl]))
)
我使用的是线状图,我还将图表的Min step
设置为$intrvl
。这是根据时间范围计算百分比的正确方法吗?
发布于 2020-02-11 08:38:07
太多的示例错误消息来自Prometheus (promql/engine.go
),而不是Grafana。第4513期
您可以尝试使用PrometheusV2.5.0中引入的Prometheus标志--query.max-samples
来提高限制。(请参见prometheus -h
输出中的默认版本)。
发布于 2020-02-11 04:17:54
由于您正在使用经过深思熟虑的数据量来计算您的公式,我将考虑创建一个普罗米修斯记录规则,它将预先计算所需的值,并使用所创建的规则来计算sum_over_interval
。
发布于 2020-06-18 16:12:15
问题:在prometheus中执行大量查询的在Grafana仪表板中抛出一个错误,结果失败:
query processing would load too many samples into memory in query execution
解决方案:在prometheus配置文件中使用--query.max-samples
,并增加内存中的负载数。默认值是50000000
,增加此值取决于您的计算机功能。来自文档
--query.max-samples=50000000
Maximum number of samples a single query can load into memory.
Note that queries will fail if they try to load more samples than this into memory,
so this also limits the number of samples a query can return.
示例:假设您在docker-compose.yml
上运行docker-compose.yml
上的prometheus服务
version: '3.2'
services:
prometheus:
image: prom/prometheus:latest
expose:
- 9090
ports:
- 9090:9090
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--query.max-samples=100000000'
- '--web.external-url=http://prom.some-company-url.com:9090'
https://stackoverflow.com/questions/60160973
复制相似问题