You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common-lib/common/signal/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ These functions modify one of the signal's property and then return signal back
25
25
- withExprWrappersMixin(wrapper=[]) - wrap signal expression into additional function on top of existing wrappers.
26
26
- withOffset(offset) - add offset modifier to the expression.
27
27
- withFilteringSelectorMixin(mixin) - add additional selector to filteringSelector used.
28
+
- withQuantile(quantile=0.95) - add quantile modifier to the expression for histogram signals.
28
29
29
30
### Render functions
30
31
@@ -103,6 +104,7 @@ Signal's level:
103
104
|sourceMaps[].valueMappings| Define signal's valueMappings in the same way defined in Grafana Dashboard Schema. |*|-|-|
104
105
|sourceMaps[].legendCustomTemplate| A custom legend template could be defined with this to override automatic legend's generation|*|`null`|`{{topic}}`|
105
106
|sourceMaps[].rangeFunction| Rate function to use for counter metrics.|rate,irate,delta,idelta,increase|`rate`|`increase`|
107
+
|sourceMaps[].quantile| Only applicable to `histogram` metrics. Defines quantile for histogram metrics. |0.01-0.99|`0.99`|`0.95`|
Copy file name to clipboardExpand all lines: common-lib/common/signal/test_histogram.libsonnet
+42-9Lines changed: 42 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -26,45 +26,78 @@ local m1 = signal.init(
26
26
27
27
{
28
28
asTarget: {
29
-
raw:: m1.asTarget(),
29
+
localraw = m1.asTarget(),
30
30
testResult: test.suite({
31
31
testLegend: {
32
-
actual:m1.asTarget().legendFormat,
32
+
actual:raw.legendFormat,
33
33
expect:'{{job}}: duration',
34
34
},
35
35
testExpression: {
36
-
actual:m1.asTarget().expr,
36
+
actual:raw.expr,
37
37
expect:'avg by (job) (\n histogram_quantile(0.95, sum(rate(apiserver_request_duration_seconds_bucket{job="abc",job=~"$job",instance=~"$instance"}[10m])) by (le,job))\n)',
expect:'avg by (job,handler) (\n histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket{job="abc",job=~"$job",instance=~"$instance"}[10m])) by (le,job,handler))\n)',
expect:'avg by (job,handler) (\n histogram_quantile(0.50, sum(rate(http_request_duration_seconds_bucket{job="abc",job=~"$job",instance=~"$instance"}[10m])) by (le,job,handler))\n)',
0 commit comments