Coder Social home page Coder Social logo

Comments (6)

rsevilla87 avatar rsevilla87 commented on June 11, 2024 3

More tests:

Query: max_over_time(rate(node_forks_total[2m])[5h:])

# Using an instant query
$ curl -s 'http://demo.robustperception.io:9090/api/v1/query?query=max_over_time%28rate%28node_forks_total%5B2m%5D%29%5B5h%3A%5D%29&time=1691492544'    | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": [
      {
        "metric": {
          "env": "demo",
          "instance": "demo.do.prometheus.io:9100",
          "job": "node"
        },
        "value": [
          1691492544,
          "2.400068573387811"
        ]
      }
    ]
  }
}

And now using the prometheus GUI to perform a query_range and verify that value is present among the plotted datapoints
image

Both values match, hence, I think we replace the kube-burner report's expressions by these ones.


Practical example

in a hypothetical workload that lasted 3721 seconds and finished at Tue Aug 8 01:57:42 we could calculate the average node cpu usage over the workload duration with an promql query like:

GET
query=avg_over_time(sum(irate(node_cpu_seconds_total{mode!="idle", mode!="steal"}[2m]))[3721s:])&timestamp=1691452662

from go-commons.

smalleni avatar smalleni commented on June 11, 2024

@vishnuchalla @rsevilla87 @jtaleric FYI

from go-commons.

rsevilla87 avatar rsevilla87 commented on June 11, 2024

mm, this is interesting, I've digged a little in the avg_over_time() functions and I think we may use them by combining instant queries and using a time range with a colon notation in order to get the aggregated values up to the passed timestamp:

Example:

$ curl -s 'http://demo.robustperception.io:9090/api/v1/query?query=avg_over_time%28rate%28node_cpu_seconds_total%7Bmode%3D%22idle%22%7D%5B2m%5D%29%5B10m%3A%5D%29&time=1691492504'    | jq .
{
  "status": "success",
  "data": {
    "resultType": "vector",
    "result": [
      {
        "metric": {
          "cpu": "0",
          "env": "demo",
          "instance": "demo.do.prometheus.io:9100",
          "job": "node",
          "mode": "idle"
        },
        "value": [
          1691492504,
          "0.8361428571421476"
        ]
      }
    ]
  }
}

The above urlencoded query is actually avg_over_time(rate(node_cpu_seconds_total{mode="idle"}[2m])[10m:])

from go-commons.

rsevilla87 avatar rsevilla87 commented on June 11, 2024

I still have to verify whether this value is valid or not

from go-commons.

vishnuchalla avatar vishnuchalla commented on June 11, 2024

Yes we can fetch the aggregations over time and also within in a given time range

curl -kH "Authorization: Bearer TOKEN" 'PROM_URL/api/v1/query?query=avg_over_time(sum(irate(node_cpu_seconds_total[2h]))[2h:1h])'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{},"value":[1691553906.635,"103.71599999999302"]}]}}

But the only thing missing from the existing function is the step (sample collection interval), which I don't think we need here while calculating aggregations. Correct me If I am wrong!

from go-commons.

rsevilla87 avatar rsevilla87 commented on June 11, 2024

With the two previous PRs I think we can close this one

from go-commons.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.