summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-06 08:48:57 +0100
committerFlorian Dold <florian@dold.me>2024-03-06 08:49:13 +0100
commit12d2157cd71e9b0d93b70783694997ea5eb7cdb8 (patch)
treee4e6474d11bb9ed656a3f4636f9fd10eab32503e
parenta7d034920ed7e81624e8e83808f2ee93dfc321f3 (diff)
downloadwallet-core-12d2157cd71e9b0d93b70783694997ea5eb7cdb8.tar.gz
wallet-core-12d2157cd71e9b0d93b70783694997ea5eb7cdb8.tar.bz2
wallet-core-12d2157cd71e9b0d93b70783694997ea5eb7cdb8.zip
harness: observability
-rw-r--r--packages/taler-harness/src/harness/helpers.ts24
-rw-r--r--packages/taler-wallet-core/src/remote.ts2
2 files changed, 17 insertions, 9 deletions
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts
index 46dc9f9d4..ea9047d0b 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -422,22 +422,32 @@ export async function createWalletDaemonWithClient(
await walletService.start();
await walletService.pingUntilAvailable();
+ const observabilityEventFile = t.testDir + `/wallet-${args.name}-notifs.log`;
+
+ const onNotif = (notif: WalletNotification) => {
+ if (observabilityEventFile) {
+ fs.appendFileSync(
+ observabilityEventFile,
+ new Date().toISOString() + " " + JSON.stringify(notif) + "\n",
+ );
+ }
+ if (args.handleNotification) {
+ args.handleNotification(notif);
+ }
+ };
+
const walletClient = new WalletClient({
name: args.name,
unixPath: walletService.socketPath,
- onNotification(n) {
- console.log(`got ${args.name} notification`, n);
- if (args.handleNotification) {
- args.handleNotification(n);
- }
- },
+ onNotification: onNotif,
});
await walletClient.connect();
const defaultRunConfig = {
testing: {
skipDefaults: true,
+ emitObservabilityEvents: !!process.env["TALER_TEST_OBSERVABILITY"],
},
- };
+ } satisfies PartialWalletRunConfig;
await walletClient.client.call(WalletApiOperation.InitWallet, {
config: args.config ?? defaultRunConfig,
});
diff --git a/packages/taler-wallet-core/src/remote.ts b/packages/taler-wallet-core/src/remote.ts
index b81c56e0c..d7623baab 100644
--- a/packages/taler-wallet-core/src/remote.ts
+++ b/packages/taler-wallet-core/src/remote.ts
@@ -17,7 +17,6 @@
import {
CoreApiRequestEnvelope,
CoreApiResponse,
- j2s,
Logger,
OpenedPromise,
openPromise,
@@ -92,7 +91,6 @@ export async function createRemoteWallet(
onMessage(m) {
// FIXME: use a codec for parsing the response envelope!
- logger.info(`${args.name}: got message from remote: ${j2s(m)}`);
if (typeof m !== "object" || m == null) {
logger.warn(`${args.name}: message not understood (wrong type)`);
return;