commit 32a4fe6b3e2ea78313fa57f96ec8e31df2e2f148
parent 767f04761decaae0b049782c65dc11e255d05079
Author: Iván Ávalos <avalos@disroot.org>
Date: Fri, 30 Jan 2026 17:28:19 +0100
taler-util: change compacting behavior of performance stats to max()
Diffstat:
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/packages/taler-util/src/performance.ts b/packages/taler-util/src/performance.ts
@@ -53,7 +53,6 @@ export type PerformanceStat =
| {
type: PerformanceStatType.WalletRequest;
operation: string;
- requestId: string;
durationMs: number;
}
| {
@@ -101,7 +100,6 @@ export namespace PerformanceStat {
return {
type: PerformanceStatType.WalletRequest,
operation: evt.operation,
- requestId: evt.requestId,
durationMs: evt.durationMs,
};
} else if (evt.type === ObservabilityEventType.ShepherdTaskResult) {
@@ -118,7 +116,7 @@ export namespace PerformanceStat {
export function equals(a: PerformanceStat, b: PerformanceStat): boolean {
if (a.type !== b.type) return false;
if (a.type === PerformanceStatType.HttpFetch) {
- return false;
+ return a.url === b["url" as keyof typeof b];
} else if (a.type === PerformanceStatType.DbQuery) {
return (
a.name === b["name" as keyof typeof b] &&
@@ -127,9 +125,9 @@ export namespace PerformanceStat {
} else if (a.type === PerformanceStatType.Crypto) {
return a.operation === b["operation" as keyof typeof b];
} else if (a.type === PerformanceStatType.WalletRequest) {
- return false;
+ return a.operation === b["operation" as keyof typeof b];
} else if (a.type === PerformanceStatType.WalletTask) {
- return false;
+ return a.taskId === b["taskId" as keyof typeof b];
} else {
assertUnreachable(a);
}
@@ -190,7 +188,7 @@ export namespace PerformanceTable {
tab[stat.type]?.push(stat);
} else {
const existing = tab[stat.type]!![index];
- existing.durationMs += stat.durationMs;
+ existing.durationMs = Math.max(existing.durationMs, stat.durationMs);
tab[stat.type]!![index] = existing;
}
}
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -1509,6 +1509,13 @@ export type GetActiveTasksOp = {
/**
* Get a list of performance stats for diagnostics.
+ *
+ * Requires observability events to be enabled. Performance tables for the
+ * current running wallet instance are generated from observability events and
+ * stored in memory.
+ *
+ * Under each table, only the highest duration for each operation
+ * (e.g. `getBalances` wallet request) is included.
*/
export type GetPerformanceStatsOp = {
op: WalletApiOperation.TestingGetPerformanceStats;