mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
app/vmui: show less lines at metrics explorer when the instance isn't selected
Show min, max and avg graphs across instances for the selected job. This should improve usability of such a graphs when the job contains many instances. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3386
This commit is contained in:
parent
8a1775f3a6
commit
8579aecd77
1 changed files with 23 additions and 5 deletions
|
@ -45,15 +45,33 @@ const ExploreMetricItem: FC<ExploreMetricItemGraphProps> = ({
|
||||||
const base = `{${params.join(",")}}`;
|
const base = `{${params.join(",")}}`;
|
||||||
if (isBucket) {
|
if (isBucket) {
|
||||||
if (instance) {
|
if (instance) {
|
||||||
return `histogram_quantiles("quantile", 0.5, 0.95, 0.99, sum(increase(${base})) by (vmrange, le))`;
|
return `
|
||||||
|
label_map(
|
||||||
|
histogram_quantiles("__name__", 0.5, 0.95, 0.99, sum(rate(${base})) by (vmrange, le)),
|
||||||
|
"__name__",
|
||||||
|
"0.5", "q50",
|
||||||
|
"0.95", "q95",
|
||||||
|
"0.99", "q99",
|
||||||
|
)`;
|
||||||
}
|
}
|
||||||
return `histogram_quantile(0.95, sum(increase(${base})) by (instance, vmrange, le))`;
|
return `
|
||||||
|
with (q = histogram_quantile(0.95, sum(rate(${base})) by (instance, vmrange, le))) (
|
||||||
|
alias(min(q), "q95min"),
|
||||||
|
alias(max(q), "q95max"),
|
||||||
|
alias(avg(q), "q95avg"),
|
||||||
|
)`;
|
||||||
}
|
}
|
||||||
const queryBase = rateEnabled ? `rate(${base})` : base;
|
|
||||||
if (instance) {
|
if (instance) {
|
||||||
return `sum(${queryBase})`;
|
const queryBase = rateEnabled ? `label_match(rollup_rate(${base}), "rollup", "max")` : `max_over_time(${base})`;
|
||||||
|
return `alias(max(${queryBase}), "max")`;
|
||||||
}
|
}
|
||||||
return `sum(${queryBase}) by (instance)`;
|
const queryBase = rateEnabled ? `rollup_rate(${base})` : `rollup(${base})`;
|
||||||
|
return `
|
||||||
|
with (q = ${queryBase}) (
|
||||||
|
alias(min(label_match(q, "rollup", "min")), "min"),
|
||||||
|
alias(max(label_match(q, "rollup", "max")), "max"),
|
||||||
|
alias(avg(label_match(q, "rollup", "avg")), "avg"),
|
||||||
|
)`;
|
||||||
}, [name, job, instance, rateEnabled, isBucket]);
|
}, [name, job, instance, rateEnabled, isBucket]);
|
||||||
|
|
||||||
const { isLoading, graphData, error, warning } = useFetchQuery({
|
const { isLoading, graphData, error, warning } = useFetchQuery({
|
||||||
|
|
Loading…
Reference in a new issue