Skip to content

Commit

Permalink
New Features:
Browse files Browse the repository at this point in the history
1. Flamegraph navigation by product and date
New Pages:
1. flame-graph-for.page.html
2. flame-graph-date.page.html
Bugs Corrected:
1. Ghost object in DB flame-graph-date.page.html
To Be Corrected:
0. On product delete, delete trace results
1. On product delete, delete flamegraph results
  • Loading branch information
juanfranciscocis committed Aug 14, 2024
1 parent 1970a70 commit 67f0e6d
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/app/pages/flame-graph-date/flame-graph-date.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<ion-content [fullscreen]="true">



<ion-refresher slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content></ion-refresher-content>
</ion-refresher>

<ion-grid>
<app-title [title]="'Usage for date'"></app-title>
Expand Down
35 changes: 33 additions & 2 deletions src/app/pages/flame-graph/flame-graph.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Component, OnInit } from '@angular/core';
import {FlameGraphConfig} from "ngx-flamegraph";
import {RawData} from "ngx-flamegraph/lib/utils";
import {FlameGraphService} from "../../services/flame-graph.service";
import {LoadingController} from "@ionic/angular";
import {ActivatedRoute, Router} from "@angular/router";
import {Product} from "../../interfaces/product";


@Component({
Expand All @@ -10,17 +14,44 @@ import {RawData} from "ngx-flamegraph/lib/utils";
})
export class FlameGraphPage implements OnInit {

product:Product = {}
date:string = ''


// @ts-ignore
config:FlameGraphConfig = {data }
config:FlameGraphConfig = {data}


constructor() { }
constructor(
private flameGraphService: FlameGraphService,
private loadingCtrl: LoadingController,
private router: Router,
private route: ActivatedRoute,
) { }

ngOnInit() {
this.getProductAndDateFromParams();
}


/**
* This method gets the product and date from URL parameters.
*/
getProductAndDateFromParams() {
// Get product from URL params
this.route.queryParams.subscribe(params => {
this.product = JSON.parse(params['product']);
this.date = params['date'];
});
console.log(this.product.productObjective);
console.log(this.date);

}





}

const data = [
Expand Down
16 changes: 14 additions & 2 deletions src/app/services/flame-graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,29 @@ export class FlameGraphService {
}
}

async getDates(orgName:string, productObjective:string){
async getDates(orgName: string, productObjective: string) {
try {
const collectionRef = collection(this.firestore, 'teams', orgName, 'products', productObjective, 'cpu_usage');
const dates = await getDocs(collectionRef);
return dates.docs.map(doc => doc.id as string);
return dates.docs.map(doc => doc.id);
} catch (e) {
console.log(e);
return [];
}
}

async getFlameGraphByDate(orgName:string, productObjective:string, date:string){
try {
const collectionRef = collection(this.firestore, 'teams', orgName, 'products', productObjective, 'cpu_usage', date);
const flameGraph = await getDocs(collectionRef);
return flameGraph.docs.map(doc => doc.data());
} catch (e) {
console.log(e);
return [];
}

}




Expand Down
1 change: 1 addition & 0 deletions www/1101.e0a79530497c783e.js

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

1 change: 0 additions & 1 deletion www/1101.f7c3270bcef40a51.js

This file was deleted.

1 change: 1 addition & 0 deletions www/2839.f18aa287a35f0889.js

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

1 change: 0 additions & 1 deletion www/2839.f89495cfcfd7a447.js

This file was deleted.

1 change: 0 additions & 1 deletion www/common.4e1606ba30770961.js

This file was deleted.

1 change: 1 addition & 0 deletions www/common.954f85895ad30209.js

Large diffs are not rendered by default.

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.2756c0baf7697a4a.js" type="module"></script><script src="polyfills.e9ea84778c1ce49f.js" type="module"></script><script src="main.5a2ee82c6e83ca42.js" type="module"></script></body>
<script src="runtime.b3691e1dd012508d.js" type="module"></script><script src="polyfills.e9ea84778c1ce49f.js" type="module"></script><script src="main.4c8a11abcdd96918.js" type="module"></script></body>

</html>
1 change: 1 addition & 0 deletions www/main.4c8a11abcdd96918.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion www/main.5a2ee82c6e83ca42.js

This file was deleted.

Loading

0 comments on commit 67f0e6d

Please sign in to comment.