Skip to content

Commit

Permalink
Add runtime metric to Telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed Jan 24, 2024
1 parent 09a0fe1 commit 171b1dd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/models/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 171b1dd

Please sign in to comment.