🪢 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): report AI feature and Assistant enablement from self-hosted (#16587)
Lysander Kiesel40bf53baed88
diff --git a/web/src/features/telemetry/index.ts b/web/src/features/telemetry/index.tsindex ca2267f2e8..d422b13d97 100644--- a/web/src/features/telemetry/index.ts+++ b/web/src/features/telemetry/index.ts@@ -10,6 +10,10 @@ import {logger,} from "@langfuse/shared/src/server";import { env } from "@/src/env.mjs";+import {+ getInAppAgentModelConfig,+ isInAppAgentInstanceEnabled,+} from "@langfuse/shared/in-app-agent/server/modelProvider";// Interval between jobs in minutesconst JOB_INTERVAL_MINUTES = Prisma.raw("720"); // 12 hours@@ -237,6 +241,26 @@ async function posthogTelemetry({0,);+ // AI features. Organizations opt in individually, so the enabled count+ // needs the total as its denominator. Runs are counted unconditionally:+ // zero on an instance that never enabled the Assistant is itself the+ // answer we are looking for.+ const totalOrganizations = await prisma.organization.count();+ const aiFeaturesEnabledOrganizations = await prisma.organization.count({+ where: { aiFeaturesEnabled: true },+ });+ const countAssistantRuns = await prisma.inAppAgentRun.count({+ where: {+ createdAt: {+ gte: startTimeframe?.toISOString(),+ lt: endTimeframe.toISOString(),+ },+ },+ });+ // Resolve through the product config, not env vars, so telemetry cannot+ // claim an instance is configured when the Assistant refuses to run.+ const modelConfig = getInAppAgentModelConfig();+// Domains (no PII)const domains = await prisma.$queryRaw<Array<{ domain: string }>>`SELECT@@ -267,6 +291,12 @@ async function posthogTelemetry({endTimeframe: endTimeframe.toISOString(),eeLicenseKey: env.LANGFUSE_EE_LICENSE_KEY,langfuseCloudRegion: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,+ totalOrganizations: totalOrganizations,+ aiFeaturesEnabledOrganizations: aiFeaturesEnabledOrganizations,+ assistantRuns: countAssistantRuns,+ assistantInstanceEnabled: isInAppAgentInstanceEnabled(),+ langfuseAiModelConfigured: modelConfig !== undefined,+ langfuseAiProvider: modelConfig?.provider ?? null,$set: {environment: process.env.NODE_ENV,userDomains: domains,