Skip to content

Commit

Permalink
Fallback to profiling-events if down-sampling index fails (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot committed Jul 5, 2022
1 parent 7fa8068 commit 93b60bb
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/plugins/profiling/server/routes/search_flamechart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,22 @@ async function queryFlameGraph(
logger,
'query to find downsampled index',
async () => {
const resp = await client.search({
index: downsampledIndex + initialExp,
body: {
query: filter,
size: 0,
track_total_hits: true,
},
});
const sampleCountFromInitialExp = resp.body.hits.total?.value as number;
let sampleCountFromInitialExp = 0;
try {
const resp = await client.search({
index: downsampledIndex + initialExp,
body: {
query: filter,
size: 0,
track_total_hits: true,
},
});
sampleCountFromInitialExp = resp.body.hits.total?.value as number;
} catch (e) {
logger.info(e.message);
}

logger.info('sampleCountFromPow6 ' + sampleCountFromInitialExp);

return getSampledTraceEventsIndex(index, sampleSize, sampleCountFromInitialExp, initialExp);
}
);
Expand Down

0 comments on commit 93b60bb

Please sign in to comment.