MCPcopy Create free account
hub / github.com/MemTensor/MemOS / constructor

Method constructor

packages/memos-core/src/telemetry.ts:75–103  ·  view source on GitHub ↗
(config: TelemetryConfig, stateDir: string, pluginVersion: string, log: Logger, pluginDir?: string)

Source from the content-addressed store, hash-verified

73 private platform: string;
74
75 constructor(config: TelemetryConfig, stateDir: string, pluginVersion: string, log: Logger, pluginDir?: string) {
76 this.log = log;
77 this.pluginVersion = pluginVersion;
78 this.enabled = config.enabled !== false;
79 this.distinctId = this.loadOrCreateAnonymousId(stateDir);
80 this.firstSeenDate = this.loadOrCreateFirstSeen(stateDir);
81 this.sessionId = this.loadOrCreateSessionId(stateDir);
82
83 this.platform = config.platform ?? "openclaw";
84
85 const creds = loadTelemetryCredentials(pluginDir);
86 this.armsEndpoint = creds.endpoint;
87 this.armsPid = creds.pid;
88 this.armsEnv = creds.env;
89
90 if (!this.enabled || !this.armsEndpoint) {
91 this.enabled = false;
92 this.log.debug(
93 !this.armsEndpoint
94 ? "Telemetry disabled (no credentials configured)"
95 : "Telemetry disabled (opt-out)",
96 );
97 return;
98 }
99
100 this.flushTimer = setInterval(() => this.flush(), FLUSH_INTERVAL_MS);
101 if (this.flushTimer.unref) this.flushTimer.unref();
102 this.log.debug("Telemetry initialized (ARMS)");
103 }
104
105 private loadOrCreateAnonymousId(stateDir: string): string {
106 const newDir = path.join(stateDir, "memos-local");

Callers

nothing calls this directly

Calls 6

loadOrCreateFirstSeenMethod · 0.95
loadOrCreateSessionIdMethod · 0.95
flushMethod · 0.95
loadTelemetryCredentialsFunction · 0.70
debugMethod · 0.65

Tested by

no test coverage detected