Skip to content

Commit

Permalink
Get executables for flamegraph nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcrail authored and rockdaboot committed Jul 5, 2022
1 parent df2a2c4 commit 2f52e94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/plugins/profiling/server/routes/flamegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
*/

export class FlameGraph {
constructor(events, totalEvents, stackTraces, stackFrames) {
constructor(events, totalEvents, stackTraces, stackFrames, executables) {
this.events = events;
this.totalEvents = totalEvents;
this.stacktraces = stackTraces;
this.stackframes = stackFrames;
this.executables = executables;
}

toElastic() {
Expand Down
17 changes: 16 additions & 1 deletion src/plugins/profiling/server/routes/search_flameChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,26 @@ export function registerFlameChartSearchRoute(router: IRouter<DataRequestHandler
body: { ids: [...stackFrameDocIDs] },
});

const executableDocIDs = new Set<string>();
for (const trace of resStackTraces.body.docs) {
if (trace.found) {
for (const fileID of trace._source.FileID) {
executableDocIDs.add(fileID);
}
}
}

const resExecutables = await esClient.mget<any>({
index: 'profiling-executables',
body: { ids: [...executableDocIDs] },
});

const flamegraph = new FlameGraph(
resEvents.body,
resTotalEvents.body,
resStackTraces.body.docs,
resStackFrames.body.docs
resStackFrames.body.docs,
resExecutables.body.docs
);

return response.ok({
Expand Down

0 comments on commit 2f52e94

Please sign in to comment.