Merge pull request #14895 from prometheus/fix-limit-ratio-explain
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (0) (push) Waiting to run
CI / Build Prometheus for common architectures (1) (push) Waiting to run
CI / Build Prometheus for common architectures (2) (push) Waiting to run
CI / Build Prometheus for all architectures (0) (push) Waiting to run
CI / Build Prometheus for all architectures (1) (push) Waiting to run
CI / Build Prometheus for all architectures (10) (push) Waiting to run
CI / Build Prometheus for all architectures (11) (push) Waiting to run
CI / Build Prometheus for all architectures (2) (push) Waiting to run
CI / Build Prometheus for all architectures (3) (push) Waiting to run
CI / Build Prometheus for all architectures (4) (push) Waiting to run
CI / Build Prometheus for all architectures (5) (push) Waiting to run
CI / Build Prometheus for all architectures (6) (push) Waiting to run
CI / Build Prometheus for all architectures (7) (push) Waiting to run
CI / Build Prometheus for all architectures (8) (push) Waiting to run
CI / Build Prometheus for all architectures (9) (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

Fix HTML rendering for aggregator Explain view
This commit is contained in:
Julius Volz 2024-09-10 18:05:51 +02:00 committed by GitHub
commit ad652de29a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,20 +46,34 @@ const describeAggregationType = (
); );
case "bottomk": case "bottomk":
if (param === null || param.type !== "numberLiteral") { if (param === null || param.type !== "numberLiteral") {
return <>returns the bottom <span className="promql-code promql-number">K</span> series by value</>; return (
<>
returns the bottom{" "}
<span className="promql-code promql-number">K</span> series by value
</>
);
} }
return ( return (
<> <>
returns the bottom <span className="promql-code promql-number">{param.val}</span> series by value returns the bottom{" "}
<span className="promql-code promql-number">{param.val}</span> series
by value
</> </>
); );
case "topk": case "topk":
if (param === null || param.type !== "numberLiteral") { if (param === null || param.type !== "numberLiteral") {
return <>returns the top <span className="promql-code promql-number">K</span> series by value</>; return (
<>
returns the top <span className="promql-code promql-number">K</span>{" "}
series by value
</>
);
} }
return ( return (
<> <>
returns the top <span className="promql-code promql-number">{param.val}</span> series by value returns the top{" "}
<span className="promql-code promql-number">{param.val}</span> series
by value
</> </>
); );
case "quantile": case "quantile":
@ -77,20 +91,30 @@ const describeAggregationType = (
case "limitk": case "limitk":
if (param === null || param.type !== "numberLiteral") { if (param === null || param.type !== "numberLiteral") {
return <>limits the output to <span className="promql-code promql-number">K</span> series</>; return (
<>
limits the output to{" "}
<span className="promql-code promql-number">K</span> series
</>
);
} }
return ( return (
<> <>
limits the output to <span className="promql-code promql-number">{param.val}</span> series limits the output to{" "}
<span className="promql-code promql-number">{param.val}</span> series
</> </>
); );
case "limit_ratio": case "limit_ratio":
if (param === null || param.type !== "numberLiteral") { if (param === null || param.type !== "numberLiteral") {
return "limits the output to a ratio of the input series"; return "limits the output to a ratio of the input series";
} }
return `limits the output to a ratio of <span className="promql-code promql-number">${param.val}</span> (${ return (
parsePrometheusFloat(param.val) * 100 <>
}%) of the input series`; limits the output to a ratio of{" "}
<span className="promql-code promql-number">{param.val}</span> (
{parsePrometheusFloat(param.val) * 100}%) of the input series
</>
);
default: default:
throw new Error(`invalid aggregation type ${aggrType}`); throw new Error(`invalid aggregation type ${aggrType}`);
} }