mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +00:00
docs(benchmarks): v2.70.0 (#9416)
# Which Problems Are Solved No benchmarks for v2.70.0 were provided so far. # How the Problems Are Solved Benchmarks added # Additional changes - it's now possible to plot multiple charts, one chart per `metric_name`
This commit is contained in:
@@ -2,6 +2,30 @@ import React from "react";
|
||||
import Chart from "react-google-charts";
|
||||
|
||||
export function BenchmarkChart(testResults=[], height='500px') {
|
||||
const dataPerMetric = new Map();
|
||||
let maxVValue = 0;
|
||||
|
||||
JSON.parse(testResults.testResults).forEach((result) => {
|
||||
if (!dataPerMetric.has(result.metric_name)) {
|
||||
dataPerMetric.set(result.metric_name, [
|
||||
[
|
||||
{type:"datetime", label: "timestamp"},
|
||||
{type:"number", label: "p50"},
|
||||
{type:"number", label: "p95"},
|
||||
{type:"number", label: "p99"},
|
||||
],
|
||||
]);
|
||||
}
|
||||
if (result.p99 > maxVValue) {
|
||||
maxVValue = result.p99;
|
||||
}
|
||||
dataPerMetric.get(result.metric_name).push([
|
||||
new Date(result.timestamp),
|
||||
result.p50,
|
||||
result.p95,
|
||||
result.p99,
|
||||
]);
|
||||
});
|
||||
|
||||
const options = {
|
||||
legend: { position: 'bottom' },
|
||||
@@ -11,35 +35,27 @@ export function BenchmarkChart(testResults=[], height='500px') {
|
||||
},
|
||||
vAxis: {
|
||||
title: 'latency (ms)',
|
||||
maxValue: maxVValue,
|
||||
},
|
||||
title: ''
|
||||
};
|
||||
|
||||
const data = [
|
||||
[
|
||||
{type:"datetime", label: "timestamp"},
|
||||
{type:"number", label: "p50"},
|
||||
{type:"number", label: "p95"},
|
||||
{type:"number", label: "p99"},
|
||||
],
|
||||
]
|
||||
|
||||
JSON.parse(testResults.testResults).forEach((result) => {
|
||||
data.push([
|
||||
new Date(result.timestamp),
|
||||
result.p50,
|
||||
result.p95,
|
||||
result.p99,
|
||||
])
|
||||
const charts = [];
|
||||
|
||||
dataPerMetric.forEach((data, metric) => {
|
||||
const opt = Object.create(options);
|
||||
opt.title = metric;
|
||||
charts.push(
|
||||
<Chart
|
||||
chartType="LineChart"
|
||||
width="100%"
|
||||
height={height}
|
||||
options={opt}
|
||||
data={data}
|
||||
legendToggle
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<Chart
|
||||
chartType="LineChart"
|
||||
width="100%"
|
||||
height="500px"
|
||||
options={options}
|
||||
data={data}
|
||||
legendToggle
|
||||
/>
|
||||
);
|
||||
|
||||
return (charts);
|
||||
}
|
Reference in New Issue
Block a user