Add runtime metric to Telemetry

This commit is contained in:
timothycarambat 2024-01-24 10:40:31 -08:00
parent 09a0fe1c81
commit 171b1dd9aa

View File

@ -28,11 +28,22 @@ const Telemetry = {
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 {
const { client, distinctId: systemId } = await this.connect();
if (!client) return;
const distinctId = !!subUserId ? `${systemId}::${subUserId}` : systemId;
const properties = { ...eventProperties, runtime: this.runtime() };
console.log(`\x1b[32m[TELEMETRY SENT]\x1b[0m`, {
event,
distinctId,