mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-10-02 08:50:11 +02:00
Add runtime metric to Telemetry
This commit is contained in:
parent
09a0fe1c81
commit
171b1dd9aa
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user