diff --git a/pyroscope/merge_stack_traces.js b/pyroscope/merge_stack_traces.js index f8664712..e4654592 100644 --- a/pyroscope/merge_stack_traces.js +++ b/pyroscope/merge_stack_traces.js @@ -143,8 +143,6 @@ const importStackTraces = async (typeRegex, sel, fromTimeSec, toTimeSec, log, _c ofs += profLen } start = process.hrtime?.bigint ? process.hrtime.bigint() : BigInt(0) - save && require('fs').writeFileSync(`/home/hromozeka/QXIP/qryn/data.${Date.now()}.bin`, - Buffer.from(Uint8Array.from(profiles.data.slice(ofs)))) pprofBin.merge_tree(_ctxIdx, Uint8Array.from(profiles.data.slice(ofs)), typeRegex.sampleType + ':' + typeRegex.sampleUnit) const mergeTreeLat = (process.hrtime?.bigint ? process.hrtime.bigint() : BigInt(0)) - start diff --git a/pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm b/pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm index a110fa20..6380006b 100644 Binary files a/pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm and b/pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm differ diff --git a/pyroscope/pprof-bin/src/lib.rs b/pyroscope/pprof-bin/src/lib.rs index e3985831..c07523a7 100644 --- a/pyroscope/pprof-bin/src/lib.rs +++ b/pyroscope/pprof-bin/src/lib.rs @@ -23,6 +23,8 @@ use std::vec::Vec; use wasm_bindgen::prelude::*; use std::sync::Arc; +//TODO: REMOVE +use std::fs; pub mod pprof_pb { @@ -80,6 +82,9 @@ struct Tree { impl Tree { pub fn total(&self) -> i64 { let mut total: i64 = 0; + if !self.nodes.contains_key(&0) { + return 0 as i64; + } for c in 0..self.nodes.get(&0).unwrap().len() { let _c = &self.nodes.get(&0).unwrap()[c]; total += _c.total[0]; diff --git a/pyroscope/pprof.js b/pyroscope/pprof.js index e261d79e..144e3f3d 100644 --- a/pyroscope/pprof.js +++ b/pyroscope/pprof.js @@ -136,7 +136,6 @@ const bfs = (t) => { * @param {string} sampleType */ const createFlameGraph = (pprofBinaries, sampleType) => { - console.log(`got ${pprofBinaries.length} profiles`) const tree = new Tree() tree.sampleType = sampleType let start = Date.now() @@ -144,10 +143,8 @@ const createFlameGraph = (pprofBinaries, sampleType) => { const prof = messages.Profile.deserializeBinary(p) tree.merge(prof) } - console.log(`ds + merge took ${Date.now() - start} ms`) start = Date.now() const levels = bfs(tree) - console.log(`bfs took ${Date.now() - start} ms`) return { levels: levels, names: tree.names, total: parseInt(tree.root.total), maxSelf: parseInt(tree.maxSelf) } } diff --git a/pyroscope/pyroscope.js b/pyroscope/pyroscope.js index f979e10a..57609adc 100644 --- a/pyroscope/pyroscope.js +++ b/pyroscope/pyroscope.js @@ -402,7 +402,6 @@ const analyzeQuery = async (req, res) => { const toTimeSec = Math.floor(req.getEnd && req.getEnd() ? parseInt(req.getEnd()) / 1000 : Date.now() / 1000) - console.log(query) const scope = new messages.QueryScope() scope.setComponentType('store') diff --git a/pyroscope/select_series.js b/pyroscope/select_series.js index 0f406654..f25db50c 100644 --- a/pyroscope/select_series.js +++ b/pyroscope/select_series.js @@ -133,7 +133,6 @@ const selectSeriesImpl = async (fromTimeSec, toTimeSec, payload) => { const resp = new messages.SelectSeriesResponse() resp.setSeriesList(seriesList) - console.log(`Queried ${seriesList.length} series`) return resp }