Comments (6)
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
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:])×tamp=1691452662
from go-commons.
@vishnuchalla @rsevilla87 @jtaleric FYI
from go-commons.
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.
I still have to verify whether this value is valid or not
from go-commons.
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.
With the two previous PRs I think we can close this one
from go-commons.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-commons.