mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
Add runtime metric to Telemetry
This commit is contained in:
parent
09a0fe1c81
commit
171b1dd9aa
1 changed files with 12 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue