Skip to content
Snippets Groups Projects
Commit 171b1dd9 authored by timothycarambat's avatar timothycarambat
Browse files

Add runtime metric to Telemetry

parent 09a0fe1c
No related branches found
No related tags found
No related merge requests found
...@@ -28,11 +28,22 @@ const Telemetry = { ...@@ -28,11 +28,22 @@ const Telemetry = {
return new PostHog(this.pubkey); return new PostHog(this.pubkey);
}, },
sendTelemetry: async function (event, properties = {}, subUserId = null) { runtime: function () {
if (process.env.ANYTHING_LLM_RUNTIME === "docker") return "docker";
if (process.env.NODE_ENV === "production") return "production";
return "other";
},
sendTelemetry: async function (
event,
eventProperties = {},
subUserId = null
) {
try { try {
const { client, distinctId: systemId } = await this.connect(); const { client, distinctId: systemId } = await this.connect();
if (!client) return; if (!client) return;
const distinctId = !!subUserId ? `${systemId}::${subUserId}` : systemId; const distinctId = !!subUserId ? `${systemId}::${subUserId}` : systemId;
const properties = { ...eventProperties, runtime: this.runtime() };
console.log(`\x1b[32m[TELEMETRY SENT]\x1b[0m`, { console.log(`\x1b[32m[TELEMETRY SENT]\x1b[0m`, {
event, event,
distinctId, distinctId,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment