Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial check in for Perf Traffic Light #977

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TestResultSummaryService/DataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DataManager {
Object.keys(Parsers).map(async (type) => {
if (Parsers[type].canParse(buildName, output)) {
const parser = new Parsers[type](buildName);
return await parser.parse(output);
return await parser.parse(output, buildName);
}
})
);
Expand Down
4 changes: 3 additions & 1 deletion TestResultSummaryService/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions TestResultSummaryService/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"got": "^11.8.5",
"jenkins-api": "^0.3.1",
"jsonwebtoken": "^9.0.0",
"lodash": "^4.17.21",
"mathjs": "^7.6.0",
"mongodb": "^3.6.10",
"request": "^2.88.2",
Expand Down
10 changes: 7 additions & 3 deletions TestResultSummaryService/parsers/Build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Parser = require('./Parser');

//ToDo: this is a place holder for build
class Build extends Parser {
static canParse(buildName, output) {
static canParse(buildName) {
return (
buildName.match(/^Build-/) ||
buildName.match(/IBMJAVA-build/) ||
Expand All @@ -12,10 +12,14 @@ class Build extends Parser {
);
}

parse(output) {
parse(output, buildName) {
let type = 'Build';
if (buildName.match(/^Perf_openjdk/)) {
type = 'Perf';
}
return {
build: null,
type: 'Build',
type,
machine: this.extractMachineInfo(output),
};
}
Expand Down
2 changes: 1 addition & 1 deletion TestResultSummaryService/parsers/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Parser {
curRegexResult = null;
// parse jdk date from javaVersion
if ((curRegexResult = javaBuildDateRegex.exec(javaVersion)) !== null) {
jdkDate = curRegexResult[0];
jdkDate = curRegexResult[0].trim();
}
return { javaVersion, jdkDate, sdkResource };
}
Expand Down
17 changes: 12 additions & 5 deletions TestResultSummaryService/perf/DataManagerAggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class DataManagerAggregate {
static aggDataCollect(childBuild) {
let aggRawMetricValues = {};
if (Array.isArray(childBuild.tests) && childBuild.tests.length > 0) {
const { buildName } = childBuild;
for (let {
benchmarkName,
benchmarkVariant,
Expand All @@ -19,8 +20,7 @@ class DataManagerAggregate {
testData.metrics.length > 0
) {
// Example: Jenkins build (running 2 benchmarks with 2 iterations) in this order: Benchmark_1, Benchmark_2, Benchmark_1, Benchmark_2.
let name_variant_key =
benchmarkName + '&&' + benchmarkVariant; //use benchmarkName and benchmarkVariant to make a unique name_variant key
let name_variant_key = `${benchmarkName}&&${benchmarkVariant}&&${buildName}`; //use benchmarkName and benchmarkVariant to make a unique name_variant key
/**
* Check aggRawMetricValues JSON object and see if it could include an existing name_variant key,
* If yes, we should concatenate our raw value collections to the end of the existing name_variant value
Expand Down Expand Up @@ -67,15 +67,20 @@ class DataManagerAggregate {
*/
let validAggregateInfo = true;
const aggregateInfo = [];
let benchmarkName, benchmarkVariant;
let benchmarkName, benchmarkVariant, buildName;
if (
((jdkDate && javaVersion) || (nodeRunDate && nodeVersion)) &&
aggRawMetricValues &&
Object.keys(aggRawMetricValues).length > 0
) {
Object.keys(aggRawMetricValues).forEach(function (name_variant) {
benchmarkName = name_variant.split('&&')[0];
benchmarkVariant = name_variant.split('&&')[1];
const tokens = name_variant.split('&&');
if (tokens.length === 3) {
benchmarkName = tokens[0];
benchmarkVariant = tokens[1];
buildName = tokens[2];
}

const metrics = [];
let benchmarkMetricsCollection =
aggRawMetricValues[name_variant];
Expand Down Expand Up @@ -130,6 +135,7 @@ class DataManagerAggregate {
aggregateInfo.push({
benchmarkName,
benchmarkVariant,
buildName,
metrics,
});
});
Expand All @@ -141,6 +147,7 @@ class DataManagerAggregate {
for (let {
benchmarkName,
benchmarkVariant,
buildName,
metrics,
} of aggregateInfo) {
if (
Expand Down
2 changes: 1 addition & 1 deletion TestResultSummaryService/plugins/DataManagerPerf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports.onBuildDone = async (task, { testResultsDB, logger }) => {
task.buildName,
task.buildNum
);
if (task.type === 'Perf') {
if (task.type === 'Perf' || task.buildName.match(/^Perf_openjdk/)) {
if (!task.aggregateInfo) {
let jdkDate, javaVersion, nodeRunDate, nodeVersion;
let aggRawMetricValuesOfChildren = {}; //aggRawMetricValuesOfChildren is a new aggregate collection used to collect all children's aggRawMetricValues
Expand Down
10 changes: 7 additions & 3 deletions TestResultSummaryService/routes/getBenchmarkMetricProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ const benchmarkMetric = require('../parsers/BenchmarkMetric');
const utils = require('../parsers/Utils');
module.exports = async (req, res) => {
const { benchmarkName } = req.query;
const key = utils.getBenchmarkParserKey(benchmarkName);
if (key) {
res.json(benchmarkMetric[key]['metrics']);
if (benchmarkName) {
const key = utils.getBenchmarkParserKey(benchmarkName);
if (key) {
res.json(benchmarkMetric[key]['metrics']);
}
} else {
res.json(benchmarkMetric);
}
res.json();
};
41 changes: 41 additions & 0 deletions TestResultSummaryService/routes/getTrafficLightData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { TestResultsDB } = require('../Database');
const ObjectID = require('mongodb').ObjectID;

module.exports = async (req, res) => {
const db = new TestResultsDB();
let results = null;
let rootBuildId;
if (req.query.rootBuildId) {
rootBuildId = new ObjectID(req.query.rootBuildId);
}
let query = {
buildName: {
$regex: 'Perf_openjdk.*perf_.*(?<!test|baseline)$',
},
rootBuildId,
};
if (req.query.buildType === 'baseline' || req.query.buildType === 'test') {
const aggregateInfoBuildNameRegex = `.*_${req.query.buildType}`;
results = await db.aggregate([
{
$match: query,
},
// Needed to access values inside array
{ $unwind: '$aggregateInfo' },
{
$match: {
'aggregateInfo.buildName': {
$regex: aggregateInfoBuildNameRegex,
},
},
},
{
$project: {
aggregateInfo: 1,
buildName: 1,
},
},
]);
}
res.send(results);
};
1 change: 1 addition & 0 deletions TestResultSummaryService/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ app.get('/getLastBuildInfo', require('./getLastBuildInfo'));
app.get('/getLogStream', require('./getLogStream'));
app.get('/getOutputById', require('./getOutputById'));
app.get('/getOutputByTestInfo', require('./getOutputByTestInfo'));
app.get('/getTrafficLightData', require('./getTrafficLightData'));
app.get('/getTestAvgDuration', require('./getTestAvgDuration'));
app.get('/getTestInfoByBuildInfo', require('./getTestInfoByBuildInfo'));
app.get('/getAzDoRun', require('./getAzDoRun'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Select } from 'antd';

export default class InoutSelect extends Component {
export default class InputSelect extends Component {
render() {
const options = this.props.options.map((value) => ({ value }));
return (
Expand Down
13 changes: 13 additions & 0 deletions test-result-summary-client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { TestCompare } from './TestCompare/';
import { ThirdPartyAppView } from './ThirdPartyAppView/';
import { PerfCompare } from './PerfCompare/';
import { TabularView } from './TabularView/';
import { TrafficLight } from './TrafficLight/';
import { AdvancedSearch } from './AdvancedSearch/';

import {
Expand Down Expand Up @@ -141,6 +142,14 @@ export default class App extends Component {
</Link>
),
},
{
key: 'sub4',
label: (
<Link to="/trafficLight">
Traffic Light
</Link>
),
},
],
},
{
Expand Down Expand Up @@ -221,6 +230,10 @@ export default class App extends Component {
path="/tabularView"
element={<TabularView />}
/>
<Route
path="/trafficLight"
element={<TrafficLight />}
/>
<Route
path="/buildDetail"
element={<BuildDetail />}
Expand Down
21 changes: 21 additions & 0 deletions test-result-summary-client/src/Components/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Button as AntdButton, Spin } from 'antd';
import { useState } from 'react';
export const Button = ({ children, ...props }) => {
const [loading, setLoading] = useState(false);
const onClick = async (...args) => {
try {
setLoading(true);
await props.onClick(...args);
} finally {
setLoading(false);
}
};
return (
<>
<AntdButton {...props} onClick={onClick}>
{children}
</AntdButton>
{loading && <Spin />}
</>
);
};
Loading
Loading