首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Grafana Prometheus -查询处理会在查询执行过程中将过多的示例加载到内存中。

Grafana Prometheus -查询处理会在查询执行过程中将过多的示例加载到内存中。
EN

Stack Overflow用户
提问于 2020-02-11 02:01:49
回答 4查看 5.5K关注 0票数 1

我试图让我的查询在grafana中对间隔进行求和,但我得到了以下错误:

代码语言:javascript
运行
复制
"query processing would load too many samples into memory in query execution"

如果我每天隔一段时间看过去的30天。

我有一个名为intrvl的变量,其时间间隔为1m, 1h, 12h, 24h, and 30d,我的查询如下所示:

代码语言:javascript
运行
复制
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。这是根据时间范围计算百分比的正确方法吗?

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2020-02-11 08:38:07

太多的示例错误消息来自Prometheus (promql/engine.go),而不是Grafana。第4513期

您可以尝试使用PrometheusV2.5.0中引入的Prometheus标志--query.max-samples来提高限制。(请参见prometheus -h输出中的默认版本)。

票数 3
EN

Stack Overflow用户

发布于 2020-02-11 04:17:54

由于您正在使用经过深思熟虑的数据量来计算您的公式,我将考虑创建一个普罗米修斯记录规则,它将预先计算所需的值,并使用所创建的规则来计算sum_over_interval

票数 4
EN

Stack Overflow用户

发布于 2020-06-18 16:12:15

问题:在prometheus中执行大量查询的在Grafana仪表板中抛出一个错误,结果失败:

代码语言:javascript
运行
复制
query processing would load too many samples into memory in query execution

解决方案:在prometheus配置文件中使用--query.max-samples,并增加内存中的负载数。默认值是50000000,增加此值取决于您的计算机功能。来自文档

代码语言:javascript
运行
复制
--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服务

代码语言:javascript
运行
复制
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'
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60160973

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档