Skip to content

Commit

Permalink
New Features:
Browse files Browse the repository at this point in the history
1. Http number of requests
2.Http codes
3. Http response time
New Pages:
1. Load Test Chooser Page
Bugs Corrected:
1.No se estan mostrando los datos en orden por fecha
To Be Corrected:
0. On product delete, delete trace results
1. On product delete, delete flamegraph result
  • Loading branch information
juanfranciscocis committed Sep 18, 2024
1 parent 38981d9 commit fbc54c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
33 changes: 16 additions & 17 deletions src/app/pages/load_test/load-test/load-test.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ responseTimeOptions: EChartsOption = {
}

async ionViewWillEnter() {
await this.showLoading();
this.getParams();
await this.getHistoryResults().then(() => {
this.plotCodes();
this.totalRequests();
this.responseTime();
});
await this.hideLoading();
}

getParams() {
Expand Down Expand Up @@ -115,13 +117,16 @@ responseTimeOptions: EChartsOption = {
}



/**
* Get the history of the load test results.
*/
async getHistoryResults() {
await this.showLoading();
this.loadTestResults = await this.loadTestService.getLoadTestHistory(this.orgName, this.productObjective, this.productStep) as ArtilleryData;
await this.hideLoading();
console.log('finished');
}

/**
* Calculate the total number of requests made in all the tests.
*/
totalRequests() {
let keys = Object.keys(this.loadTestResults);
let requests: Record<string, Record<string, number>> = {};
Expand Down Expand Up @@ -150,6 +155,10 @@ responseTimeOptions: EChartsOption = {
this.totalNumberOfRequests = totalRequests;

}

/**
* Return the status codes of the requests and plot them.
*/
byCodes() {
let keys = Object.keys(this.loadTestResults);
let codes: Record<string, Record<string, number>> = {};
Expand All @@ -176,15 +185,12 @@ responseTimeOptions: EChartsOption = {

return codes;
}

// Función para normalizar la fecha al formato YYYY-MM-DD
normalizarFecha(fecha: string): string {
const [year, month, day] = fecha.split('-').map(num => parseInt(num, 10)); // Convertimos a números para evitar ceros iniciales incorrectos
const mesNormalizado = month < 10 ? `0${month}` : month.toString(); // Agregar 0 si es necesario
const diaNormalizado = day < 10 ? `0${day}` : day.toString(); // Agregar 0 si es necesario
return `${year}-${mesNormalizado}-${diaNormalizado}`;
}

ordenarDiccionarioPorFechas(diccionario: { [key: string]: any }): { [key: string]: any } {
// Obtener las claves del diccionario (fechas)
const fechas = Object.keys(diccionario);
Expand All @@ -205,9 +211,6 @@ responseTimeOptions: EChartsOption = {
return diccionarioOrdenado;

}



async plotCodes() {
let codes = this.byCodes();
console.log(codes);
Expand Down Expand Up @@ -296,7 +299,9 @@ for (let req in codes) {
}



/**
* Calculate the average response time of the requests and plot them.
*/
responseTime() {
let keys = Object.keys(this.loadTestResults);
let responseTimes: Record<string, any> = {};
Expand Down Expand Up @@ -427,12 +432,6 @@ for (let metric in total) {









/**
* Show a loading spinner.
*/
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

<body>
<app-root></app-root>
<script src="runtime.8a26073c6736544d.js" type="module"></script><script src="polyfills.e9ea84778c1ce49f.js" type="module"></script><script src="main.f0e70fdefb798bc9.js" type="module"></script></body>
<script src="runtime.89edb3a0285b1f49.js" type="module"></script><script src="polyfills.e9ea84778c1ce49f.js" type="module"></script><script src="main.f0e70fdefb798bc9.js" type="module"></script></body>

</html>

0 comments on commit fbc54c4

Please sign in to comment.