diff --git a/.vscode/launch.json b/.vscode/launch.json index 0bd68d2913..cb4d54a67d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -124,7 +124,7 @@ // "DB_URL": "postgresql://postgres:example@localhost:5432", "DB_URL": "postgresql://root@huly.local:26258/defaultdb?sslmode=disable", // "GREEN_URL": "http://huly.local:6767?token=secret", - "SERVER_PORT": "3334", + "SERVER_PORT": "3335", "METRICS_CONSOLE": "false", "DEBUG_PRINT_SQL": "true", "METRICS_FILE": "${workspaceRoot}/metrics.txt", // Show metrics in console evert 30 seconds., @@ -135,7 +135,7 @@ "FRONT_URL": "http://localhost:8083", "ACCOUNTS_URL": "http://localhost:3003", "MODEL_JSON": "${workspaceRoot}/models/all/bundle/model.json", - "MODEL_VERSION": "0.7.75", + "MODEL_VERSION": "0.7.110", "STATS_URL": "http://huly.local:4901", "QUEUE_CONFIG": "localhost:19093" }, @@ -248,7 +248,7 @@ "request": "launch", "args": ["src/__start.ts"], "env": { - "PORT": "4900", + "PORT": "4901", "SERVER_SECRET": "secret" }, "runtimeVersion": "20", @@ -585,13 +585,12 @@ "PLATFORM_OPERATION_LOGGING": "true", "FRONT_URL": "http://localhost:8080", "PORT": "3500", - "STATS_URL": "http://huly.local:4900" + "STATS_URL": "http://huly.local:4901" }, "runtimeArgs": ["--nolazy", "-r", "ts-node/register"], "sourceMaps": true, "cwd": "${workspaceRoot}/services/github/pod-github", "protocol": "inspector", - "attachSimplePort": 0, "outputCapture": "std" }, { diff --git a/dev/tool/src/benchmark.ts b/dev/tool/src/benchmark.ts index ca3bc6f3ef..8a11b574eb 100644 --- a/dev/tool/src/benchmark.ts +++ b/dev/tool/src/benchmark.ts @@ -254,14 +254,7 @@ export async function benchmark ( // operations = 0 requestTime = 0 // transfer = 0 - const r = extract( - json.metrics as Metrics, - '🧲 session', - 'client', - 'handleRequest', - 'process', - 'find-all' - ) + const r = extract(json.metrics as Metrics, '🧲 session', 'client', 'process', 'find-all') operations = (r?.operations ?? 0) - oldOperations oldOperations = r?.operations ?? 0 diff --git a/dev/tool/src/workspace.ts b/dev/tool/src/workspace.ts index 4cfda47138..7d22191308 100644 --- a/dev/tool/src/workspace.ts +++ b/dev/tool/src/workspace.ts @@ -157,7 +157,7 @@ export async function backupRestore ( dataId: workspace.dataId, url: workspace.url } - const result: boolean = await ctx.with('restore', { workspace: workspace.url }, (ctx) => + const result: boolean = await ctx.with('restore', {}, (ctx) => restore(ctx, '', wsUrl, storage, { date: -1, skip: new Set(skipDomains), diff --git a/packages/core/src/measurements/metrics.ts b/packages/core/src/measurements/metrics.ts index fc6bfe7852..a5ec906cb4 100644 --- a/packages/core/src/measurements/metrics.ts +++ b/packages/core/src/measurements/metrics.ts @@ -84,7 +84,9 @@ export function updateMeasure ( const fParams = typeof fullParams === 'function' ? fullParams() : fullParams // Update params if required - for (const [k, v] of Object.entries(params)) { + const pparams = Object.entries(params) + if (pparams.length > 0) { + const [k, v] = pparams[0] let params = metrics.params[k] if (params === undefined) { params = {} @@ -106,7 +108,22 @@ export function updateMeasure ( param.operations++ } // Do not update top results for params. - // param.topResult = getUpdatedTopResult(param.topResult, ed - st, fParams) + if (pparams.length > 1) { + // We need to update all other params as counters. + if (param.topResult === undefined) { + param.topResult = [] + } + for (const [, v] of pparams.slice(1)) { + const r = (param.topResult ?? []).find((it) => it.params[`${v}`] === true) + if (r !== undefined) { + r.value += 1 // Counter of operations + r.time = (r.time ?? 0) + (value ?? ed - st) + } else { + param.topResult.push({ params: { [`${v}`]: true }, value: 1, time: value ?? ed - st }) + } + } + param.topResult.sort((a, b) => b.value - a.value) + } } // Update leaf data if (override === true) { diff --git a/packages/core/src/measurements/types.ts b/packages/core/src/measurements/types.ts index 52925ce27a..84b9fa483a 100644 --- a/packages/core/src/measurements/types.ts +++ b/packages/core/src/measurements/types.ts @@ -21,6 +21,7 @@ export interface MetricsData { value: number topResult?: { value: number + time?: number params: FullParamsType }[] } diff --git a/packages/core/src/server.ts b/packages/core/src/server.ts index 96fd04ef13..e277606948 100644 --- a/packages/core/src/server.ts +++ b/packages/core/src/server.ts @@ -46,6 +46,7 @@ export interface SessionData { contextCache: Map removedMap: Map, Doc> account: Account + service: string sessionId: string admin?: boolean isTriggerCtx?: boolean diff --git a/packages/ui/src/components/Popup.svelte b/packages/ui/src/components/Popup.svelte index fe8d5eb529..6f1db96fbd 100644 --- a/packages/ui/src/components/Popup.svelte +++ b/packages/ui/src/components/Popup.svelte @@ -12,11 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. --> + + +