mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
log addition info for public search demo
This commit is contained in:
parent
9a204b9557
commit
9d1ebcefaa
7 changed files with 14 additions and 10 deletions
|
|
@ -26,7 +26,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||
# @see: https://phase.dev/blog/nextjs-public-runtime-variables/
|
||||
ARG NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED=BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED
|
||||
ARG NEXT_PUBLIC_SOURCEBOT_VERSION=BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION
|
||||
ENV NEXT_PUBLIC_SEARCH_DEMO=BAKED_NEXT_PUBLIC_SEARCH_DEMO
|
||||
ENV NEXT_PUBLIC_PUBLIC_SEARCH_DEMO=BAKED_NEXT_PUBLIC_PUBLIC_SEARCH_DEMO
|
||||
ENV NEXT_PUBLIC_POSTHOG_PAPIK=BAKED_NEXT_PUBLIC_POSTHOG_PAPIK
|
||||
# @note: leading "/" is required for the basePath property. @see: https://nextjs.org/docs/app/api-reference/next-config-js/basePath
|
||||
ARG NEXT_PUBLIC_DOMAIN_SUB_PATH=/BAKED_NEXT_PUBLIC_DOMAIN_SUB_PATH
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
|
|||
export NEXT_PUBLIC_SOURCEBOT_VERSION="$SOURCEBOT_VERSION"
|
||||
fi
|
||||
|
||||
# Infer NEXT_PUBLIC_SEARCH_DEMO if it is not set
|
||||
if [ -z "$NEXT_PUBLIC_SEARCH_DEMO" ] && [ ! -z "$PUBLIC_SEARCH_DEMO" ]; then
|
||||
export NEXT_PUBLIC_SEARCH_DEMO="$PUBLIC_SEARCH_DEMO"
|
||||
# Infer NEXT_PUBLIC_PUBLIC_SEARCH_DEMO if it is not set
|
||||
if [ -z "$NEXT_PUBLIC_PUBLIC_SEARCH_DEMO" ] && [ ! -z "$PUBLIC_SEARCH_DEMO" ]; then
|
||||
export NEXT_PUBLIC_PUBLIC_SEARCH_DEMO="$PUBLIC_SEARCH_DEMO"
|
||||
fi
|
||||
|
||||
# Always infer NEXT_PUBLIC_POSTHOG_PAPIK
|
||||
|
|
@ -108,7 +108,7 @@ echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
|
|||
sed -i "s|BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED|${NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION|${NEXT_PUBLIC_SOURCEBOT_VERSION}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_POSTHOG_PAPIK|${NEXT_PUBLIC_POSTHOG_PAPIK}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_SEARCH_DEMO|${NEXT_PUBLIC_SEARCH_DEMO}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_PUBLIC_SEARCH_DEMO|${NEXT_PUBLIC_PUBLIC_SEARCH_DEMO}|g" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { useState } from "react"
|
|||
import Link from "next/link"
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { ArrowRight, Code, Database, Search } from "lucide-react"
|
||||
import { ArrowRight, Database, Search } from "lucide-react"
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent"
|
||||
|
||||
export default function RegistrationCard() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
'use client'
|
||||
import { NEXT_PUBLIC_POSTHOG_PAPIK, NEXT_PUBLIC_POSTHOG_UI_HOST, NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED } from '@/lib/environment.client'
|
||||
import { NEXT_PUBLIC_POSTHOG_PAPIK, NEXT_PUBLIC_POSTHOG_UI_HOST, NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED, NEXT_PUBLIC_PUBLIC_SEARCH_DEMO } from '@/lib/environment.client'
|
||||
import posthog from 'posthog-js'
|
||||
import { PostHogProvider } from 'posthog-js/react'
|
||||
import { resolveServerPath } from './api/(client)/client'
|
||||
|
|
@ -14,10 +14,10 @@ if (typeof window !== 'undefined') {
|
|||
api_host: posthogHostPath,
|
||||
ui_host: NEXT_PUBLIC_POSTHOG_UI_HOST,
|
||||
person_profiles: 'identified_only',
|
||||
capture_pageview: false, // Disable automatic pageview capture
|
||||
capture_pageview: NEXT_PUBLIC_PUBLIC_SEARCH_DEMO, // @nocheckin Disable automatic pageview capture if we're not in public demo mode
|
||||
autocapture: false, // Disable automatic event capture
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
sanitize_properties: (properties: Record<string, any>, _event: string) => {
|
||||
sanitize_properties: !NEXT_PUBLIC_PUBLIC_SEARCH_DEMO ? (properties: Record<string, any>, _event: string) => {
|
||||
// https://posthog.com/docs/libraries/js#config
|
||||
if (properties['$current_url']) {
|
||||
properties['$current_url'] = null;
|
||||
|
|
@ -27,7 +27,7 @@ if (typeof window !== 'undefined') {
|
|||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
} : undefined
|
||||
});
|
||||
} else {
|
||||
console.log("PostHog telemetry disabled");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import { TopBar } from "../components/topBar";
|
|||
import { CodePreviewPanel } from "./components/codePreviewPanel";
|
||||
import { FilterPanel } from "./components/filterPanel";
|
||||
import { SearchResultsPanel } from "./components/searchResultsPanel";
|
||||
import { NEXT_PUBLIC_PUBLIC_SEARCH_DEMO } from "@/lib/environment.client";
|
||||
|
||||
const DEFAULT_MAX_MATCH_DISPLAY_COUNT = 10000;
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ export default function SearchPage() {
|
|||
const fileLanguages = searchResponse.Result.Files?.map(file => file.Language) || [];
|
||||
|
||||
captureEvent("search_finished", {
|
||||
query: NEXT_PUBLIC_PUBLIC_SEARCH_DEMO ? searchQuery : null, // @nocheckin
|
||||
contentBytesLoaded: searchResponse.Result.ContentBytesLoaded,
|
||||
indexBytesLoaded: searchResponse.Result.IndexBytesLoaded,
|
||||
crashes: searchResponse.Result.Crashes,
|
||||
|
|
|
|||
|
|
@ -9,3 +9,4 @@ export const NEXT_PUBLIC_POSTHOG_ASSET_HOST = getEnv(process.env.NEXT_PUBLIC_POS
|
|||
export const NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED = getEnvBoolean(process.env.NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED, false);
|
||||
export const NEXT_PUBLIC_SOURCEBOT_VERSION = getEnv(process.env.NEXT_PUBLIC_SOURCEBOT_VERSION, "unknown")!;
|
||||
export const NEXT_PUBLIC_DOMAIN_SUB_PATH = getEnv(process.env.NEXT_PUBLIC_DOMAIN_SUB_PATH, "")!;
|
||||
export const NEXT_PUBLIC_PUBLIC_SEARCH_DEMO = getEnvBoolean(process.env.NEXT_PUBLIC_PUBLIC_SEARCH_DEMO, false);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
export type PosthogEventMap = {
|
||||
search_finished: {
|
||||
query: string | null,
|
||||
contentBytesLoaded: number,
|
||||
indexBytesLoaded: number,
|
||||
crashes: number,
|
||||
|
|
|
|||
Loading…
Reference in a new issue