diff --git a/service/pool/Logs.mo b/service/pool/Logs.mo index 46d03569..86d5b3cd 100644 --- a/service/pool/Logs.mo +++ b/service/pool/Logs.mo @@ -20,7 +20,8 @@ module { case (?n) { canisters.put(origin, n + 1) }; } }; - public func addInstall(origin: Text) { + public func addInstall(origin: Text, referrer: ?Text) { + // TODO: keep track of `referrer` switch (installs.get(origin)) { case null { installs.put(origin, 1) }; case (?n) { installs.put(origin, n + 1) }; diff --git a/service/pool/Main.mo b/service/pool/Main.mo index 7bce335f..13349c52 100644 --- a/service/pool/Main.mo +++ b/service/pool/Main.mo @@ -169,7 +169,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { }; await IC.install_code newArgs; stats := Logs.updateStats(stats, #install); - statsByOrigin.addInstall(install_config.origin); + statsByOrigin.addInstall(install_config.origin, install_config.referrer); switch (pool.refresh(info, install_config.profiling)) { case (?newInfo) { updateTimer(newInfo); @@ -335,7 +335,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { switch (sanitizeInputs(caller, canister_id)) { case (#ok info) { let args = { arg; wasm_module; mode; canister_id }; - let config = { profiling = pool.profiling caller; is_whitelisted = false; origin = "spawned" }; + let config = { profiling = pool.profiling caller; is_whitelisted = false; origin = "spawned"; referrer = null }; ignore await installCode(info, args, config); // inherit the profiling of the parent }; case (#err makeMsg) throw Error.reject(makeMsg "install_code");