🪢 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: add posthog event for tracing_check_active (#3691)
Marc Klingen408fb64c6980
diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.tsindex 1ad2cdd594..d154f3863a 100644--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts@@ -103,7 +103,7 @@ const events = {"modal_open","create_new_button_click",],- onboarding: ["code_example_tab_switch"],+ onboarding: ["code_example_tab_switch", "tracing_check_active"],user_settings: ["theme_changed"],project_settings: ["project_delete",diff --git a/web/src/features/setup/components/SetupPage.tsx b/web/src/features/setup/components/SetupPage.tsxindex 4fef7a3c12..b1c0e1f6eb 100644--- a/web/src/features/setup/components/SetupPage.tsx+++ b/web/src/features/setup/components/SetupPage.tsx@@ -9,6 +9,7 @@ import {import { Button } from "@/src/components/ui/button";import { Card } from "@/src/components/ui/card";import { NewOrganizationForm } from "@/src/features/organizations/components/NewOrganizationForm";+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { NewProjectForm } from "@/src/features/projects/components/NewProjectForm";import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks";import { ApiKeyRender } from "@/src/features/public-api/components/CreateApiKeyButton";@@ -48,19 +49,25 @@ export function SetupPage() {? 3: 2;- const hasAnyTrace =- api.traces.hasAny.useQuery(- { projectId: queryProjectId as string },- {- enabled: queryProjectId !== undefined && stepInt === 4,- refetchInterval: 5000,- trpc: {- context: {- skipBatch: true,- },+ const hasAnyTrace = api.traces.hasAny.useQuery(+ { projectId: queryProjectId as string },+ {+ enabled: queryProjectId !== undefined && stepInt === 4,+ refetchInterval: 5000,+ trpc: {+ context: {+ skipBatch: true,},},- ).data ?? false;+ },+ ).data;++ const capture = usePostHogClientCapture();+ useEffect(() => {+ if (hasAnyTrace !== undefined) {+ capture("onboarding:tracing_check_active", { active: hasAnyTrace });+ }+ }, [hasAnyTrace, capture]);return (<div className="mb-12 md:container">@@ -170,7 +177,7 @@ export function SetupPage() {<Header title="API Keys" level="h3" /><TracingSetupprojectId={project.id}- hasAnyTrace={hasAnyTrace}+ hasAnyTrace={hasAnyTrace ?? false}/></div></div>diff --git a/web/src/features/setup/components/SetupTracingButton.tsx b/web/src/features/setup/components/SetupTracingButton.tsxindex 8ca795aa03..e87aeabdbc 100644--- a/web/src/features/setup/components/SetupTracingButton.tsx+++ b/web/src/features/setup/components/SetupTracingButton.tsx@@ -6,6 +6,8 @@ import { setupTracingRoute } from "@/src/features/setup/setupRoutes";import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";import { LockIcon } from "lucide-react";import { useRouter } from "next/router";+import { useEffect } from "react";+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";const SetupTracingButton = () => {const { project } = useQueryProjectOrOrganization();@@ -25,6 +27,13 @@ const SetupTracingButton = () => {},);+ const capture = usePostHogClientCapture();+ useEffect(() => {+ if (hasAnyTrace !== undefined) {+ capture("onboarding:tracing_check_active", { active: hasAnyTrace });+ }+ }, [hasAnyTrace, capture]);+const hasAccess = useHasProjectAccess({projectId: project?.id,scope: "apiKeys:create",