🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(telemetry): count users (#563)
Marc Klingen033dd6654bfd
diff --git a/README.md b/README.mdindex b53ed984f3..0bae40dea6 100644--- a/README.md+++ b/README.md@@ -280,6 +280,6 @@ This helps us to:1. Understand how Langfuse is used and improve the most relevant features.2. Track overall usage for internal and external (e.g. fundraising) reporting.-None of the data is shared with third parties and does not include any sensitive information. We want to be super transparent about this and you can find the exact data we collect [here](/src/pages/api/cron/telemetry.ts).+None of the data is shared with third parties and does not include any sensitive information. We want to be super transparent about this and you can find the exact data we collect [here](/src/features/telemetry/index.ts).You can opt-out by setting `TELEMETRY_ENABLED=false`.diff --git a/src/features/telemetry/README.md b/src/features/telemetry/README.mdindex 27abfdda75..463e622c8f 100644--- a/src/features/telemetry/README.md+++ b/src/features/telemetry/README.md@@ -7,6 +7,6 @@ This helps us to:1. Understand how Langfuse is used and improve the most relevant features.2. Track overall usage for internal and external (e.g. fundraising) reporting.-None of the data is shared with third parties and does not include any sensitive information. We want to be super transparent about this and you can find the exact data we collect [here](/src/pages/api/cron/telemetry.ts).+None of the data is shared with third parties and does not include any sensitive information. We want to be super transparent about this and you can find the exact data we collect [here](/src/features/telemetry/index.ts).You can opt-out by setting `TELEMETRY_ENABLED=false`.diff --git a/src/features/telemetry/index.ts b/src/features/telemetry/index.tsindex f4d0283a7f..529f4fa853 100644--- a/src/features/telemetry/index.ts+++ b/src/features/telemetry/index.ts@@ -225,10 +225,23 @@ async function posthogTelemetry({},});+ // Domains (no PII)+ const domains = await prisma.$queryRaw<Array<{ domain: string }>>`+ SELECT+ substring(email FROM position('@' in email) + 1) as domain,+ count(id)::int as "userCount"+ FROM users+ WHERE email ILIKE '%@%'+ GROUP BY 1+ ORDER BY count(id) desc+ LIMIT 30+ `;+posthog.identify({distinctId: "docker:" + clientId,properties: {environment: process.env.NODE_ENV,+ userDomains: domains,docker: true,},});