mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 06:46:00 +00:00
set mongo profiling
This commit is contained in:
@@ -352,6 +352,20 @@ const driver = {
|
||||
return res;
|
||||
},
|
||||
|
||||
async summaryCommand(pool, command, row) {
|
||||
switch (command) {
|
||||
case 'profileOff':
|
||||
await pool.db(row.name).command({ profile: 0 });
|
||||
return;
|
||||
case 'profileFiltered':
|
||||
await pool.db(row.name).command({ profile: 1, slowms: 100 });
|
||||
return;
|
||||
case 'profileAll':
|
||||
await pool.db(row.name).command({ profile: 2 });
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
async serverSummary(pool) {
|
||||
const res = await pool.__getDatabase().admin().listDatabases();
|
||||
const profiling = await Promise.all(res.databases.map((x) => pool.db(x.name).command({ profile: -1 })));
|
||||
@@ -363,7 +377,7 @@ const driver = {
|
||||
case 1:
|
||||
return `Filtered (>${info.slowms} ms)`;
|
||||
case 2:
|
||||
'Profile all';
|
||||
return 'Profile all';
|
||||
default:
|
||||
return '???';
|
||||
}
|
||||
@@ -373,19 +387,37 @@ const driver = {
|
||||
columns: [
|
||||
{
|
||||
fieldName: 'name',
|
||||
dataType: 'string',
|
||||
columnType: 'string',
|
||||
header: 'Name',
|
||||
},
|
||||
{
|
||||
fieldName: 'sizeOnDisk',
|
||||
dataType: 'bytes',
|
||||
columnType: 'bytes',
|
||||
header: 'Size',
|
||||
},
|
||||
{
|
||||
fieldName: 'profiling',
|
||||
dataType: 'string',
|
||||
columnType: 'string',
|
||||
header: 'Profiling',
|
||||
},
|
||||
{
|
||||
fieldName: 'setProfile',
|
||||
columnType: 'actions',
|
||||
actions: [
|
||||
{
|
||||
header: 'Off',
|
||||
command: 'profileOff',
|
||||
},
|
||||
{
|
||||
header: 'Filtered',
|
||||
command: 'profileFiltered',
|
||||
},
|
||||
{
|
||||
header: 'All',
|
||||
command: 'profileAll',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
databases: res.databases.map((db, i) => ({
|
||||
...db,
|
||||
|
||||
Reference in New Issue
Block a user