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]))

  • 相关阅读:
    关系型数据库与非关系型数据库
    项目技术点总结
    小程序项目开发总结
    小程序的生命周期
    ES6中的class 与prototype
    js中的深拷贝与浅拷贝
    DOM的构建与优化
    ES6中promise总结
    react服务端渲染
    vue服务端渲染
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/10409009.html
Copyright © 2011-2022 走看看