zoukankan      html  css  js  c++  java
  • prometheus 表达式

    avg_over_time(my_inprogress_requests{job="mhc"}[5m] offset 3m)

    返回time=1550664637开始向前偏移3分钟之前的五分钟的平均值

    curl -X GET
      'http://mhc-linux:9090/api/v1/query?query=avg_over_time%28my_inprogress_requests{job=%22mhc%22}[5m]%20%20offset%203m%29&time=1550664637'
      -H 'Postman-Token: eeede4b6-e57b-42b1-92e1-d2dec4558f0e'
      -H 'cache-control: no-cache'

    {
        "status": "success",
        "data": {
            "resultType": "vector",
            "result": [
                {
                    "metric": {
                        "instance": "192.168.121.58:8000",
                        "job": "mhc"
                    },
                    "value": [
                        1550664637,
                        "425.1333333333333"
                    ]
                }
            ]
        }
    }

    curl -X GET
      'http://mhc-linux:9090/api/v1/query_range?query=avg_over_time%28my_inprogress_requests{job=%22mhc%22}[5m]%20%20offset%2010m%29&start=1550664637&end=1550664937&step=60'
      -H 'Postman-Token: b274b534-eede-4d4b-b85c-2f0ad8dbd44e'
      -H 'cache-control: no-cache'

    {
        "status": "success",
        "data": {
            "resultType": "matrix",
            "result": [
                {
                    "metric": {
                        "instance": "192.168.121.58:8000",
                        "job": "mhc"
                    },
                    "values": [
                        [
                            1550664637,
                            "474.0666666666666"
                        ],
                        [
                            1550664697,
                            "511.11666666666673"
                        ],
                        [
                            1550664757,
                            "468.6666666666667"
                        ],
                        [
                            1550664817,
                            "464.03333333333313"
                        ],
                        [
                            1550664877,
                            "494.83333333333326"
                        ],
                        [
                            1550664937,
                            "491.38333333333327"
                        ]
                    ]
                }
            ]
        }
    }

    sum(avg_over_time(my_inprogress_requests{user="mhc"}[1m]))

  • 相关阅读:
    chrome 开发者工具——前端实用功能总结
    而立之年——回顾我的前端转行之路
    编译原理实战入门:用 JavaScript 写一个简单的四则运算编译器(修订版)
    手把手带你入门前端工程化——超详细教程
    手把手教你搭建 Vue 服务端渲染项目
    前端项目自动化部署——超详细教程(Jenkins、Github Actions)
    前端国际化辅助工具——自动替换中文并翻译
    深入了解 webpack 模块加载原理
    实现一个 webpack loader 和 webpack plugin
    博客本地编辑器-OpenLiveWriter安装使用
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/10409009.html
Copyright © 2011-2022 走看看