Prometheus: Fix $__rate_interval calculation (#77234)

* Remove unused param

* simple unit test

* rename

* rename

* add some comments

* Update values

* refactor

* rename

* always calculate rate interval

* fix unit tests

* Fix indentation

* linter fix

* update test

* Fixing issues with the calculation

* new test

* fix $__interval interpolation

* fix test

* add comment
This commit is contained in:
ismail simsek
2023-11-13 10:13:07 +01:00
committed by GitHub
parent 4bc322ca1d
commit b607a4e0a2
3 changed files with 247 additions and 59 deletions
@@ -9,9 +9,9 @@
// "custom": {
// "resultType": "matrix"
// },
// "executedQueryString": "Expr: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[1m0s])) by (le))\nStep: 1s"
// "executedQueryString": "Expr: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[4s])) by (le))\nStep: 1s"
// }
// Name: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[1m0s])) by (le))
// Name: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[4s])) by (le))
// Dimensions: 2 Fields by 301 Rows
// +-----------------------------------+----------------------+
// | Name: Time | Name: Value |
@@ -37,7 +37,7 @@
"frames": [
{
"schema": {
"name": "histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[1m0s])) by (le))",
"name": "histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[4s])) by (le))",
"meta": {
"type": "timeseries-multi",
"typeVersion": [
@@ -47,7 +47,7 @@
"custom": {
"resultType": "matrix"
},
"executedQueryString": "Expr: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[1m0s])) by (le))\nStep: 1s"
"executedQueryString": "Expr: histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[4s])) by (le))\nStep: 1s"
},
"fields": [
{
@@ -68,7 +68,7 @@
},
"labels": {},
"config": {
"displayNameFromDS": "histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[1m0s])) by (le))"
"displayNameFromDS": "histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[4s])) by (le))"
}
}
]