diff --git a/packages/web/src/appobj/ArchiveFileAppObject.svelte b/packages/web/src/appobj/ArchiveFileAppObject.svelte index 0fcad808c..e77e42e31 100644 --- a/packages/web/src/appobj/ArchiveFileAppObject.svelte +++ b/packages/web/src/appobj/ArchiveFileAppObject.svelte @@ -214,6 +214,7 @@ tabComponent: 'ProfilerTab', props: { jslid: `archive://${data.folderName}/${data.fileName}`, + // engine: eng.engine, profilerFormatterFunction: eng.profilerFormatterFunction, profilerTimestampFunction: eng.profilerTimestampFunction, profilerChartAggregateFunction: eng.profilerChartAggregateFunction, diff --git a/packages/web/src/tabs/ProfilerTab.svelte b/packages/web/src/tabs/ProfilerTab.svelte index 8bd0cb95a..ae691bdb5 100644 --- a/packages/web/src/tabs/ProfilerTab.svelte +++ b/packages/web/src/tabs/ProfilerTab.svelte @@ -70,7 +70,7 @@ let chartData; $: connection = useConnectionInfo({ conid }); - $: engine = findEngineDriver($connection, $extensions); + $: driver = findEngineDriver($connection, $extensions); onMount(() => { intervalId = setInterval(() => { @@ -123,15 +123,15 @@ isLoadingChart = true; const colors = randomcolor({ - count: (profilerChartMeasures || engine.profilerChartMeasures).length, + count: (profilerChartMeasures || driver.profilerChartMeasures).length, seed: 5, }); const data = await apiCall('jsldata/extract-timeline-chart', { jslid, - timestampFunction: profilerTimestampFunction || engine.profilerTimestampFunction, - aggregateFunction: profilerChartAggregateFunction || engine.profilerChartAggregateFunction, - measures: profilerChartMeasures || engine.profilerChartMeasures, + timestampFunction: profilerTimestampFunction || driver.profilerTimestampFunction, + aggregateFunction: profilerChartAggregateFunction || driver.profilerChartAggregateFunction, + measures: profilerChartMeasures || driver.profilerChartMeasures, }); chartData = { ...data, @@ -202,7 +202,7 @@ diff --git a/plugins/dbgate-plugin-mongo/src/frontend/driver.js b/plugins/dbgate-plugin-mongo/src/frontend/driver.js index 39f5de887..931055634 100644 --- a/plugins/dbgate-plugin-mongo/src/frontend/driver.js +++ b/plugins/dbgate-plugin-mongo/src/frontend/driver.js @@ -40,10 +40,7 @@ const driver = { profilerChartMeasures: [ { label: 'Req count/s', field: 'countPerSec' }, { label: 'Avg duration', field: 'avgDuration' }, - - // { label: 'Req count/s', field: 'countPerSec', perSecond: true }, - // { field: 'countAll', hidden: true }, - // { label: 'Avg duration', field: 'millis', perField: 'countAll' }, + { label: 'Max duration', field: 'maxDuration' }, ], databaseUrlPlaceholder: 'e.g. mongodb://username:password@mongodb.mydomain.net/dbname', diff --git a/plugins/dbgate-plugin-mongo/src/frontend/profilerFunctions.js b/plugins/dbgate-plugin-mongo/src/frontend/profilerFunctions.js index fdff1fbe1..8eff17b72 100644 --- a/plugins/dbgate-plugin-mongo/src/frontend/profilerFunctions.js +++ b/plugins/dbgate-plugin-mongo/src/frontend/profilerFunctions.js @@ -78,12 +78,14 @@ function aggregateProfileChartEntry(aggr, obj, stepDuration) { const countAll = (aggr.countAll || 0) + 1; const sumMillis = (aggr.sumMillis || 0) + obj.millis; + const maxDuration = obj.millis > (aggr.maxDuration || 0) ? obj.millis : aggr.maxDuration || 0; return { countAll, sumMillis, countPerSec: (countAll / stepDuration) * 1000, avgDuration: sumMillis / countAll, + maxDuration, }; // return {