Simplify: remove backend analytics

This commit is contained in:
Enrico Ros
2024-11-07 14:14:02 -08:00
parent 4c1b1213b1
commit acc3bc4403
4 changed files with 1 additions and 34 deletions
-4
View File
@@ -60,9 +60,6 @@ PRODIA_API_KEY=
HTTP_BASIC_AUTH_USERNAME=
HTTP_BASIC_AUTH_PASSWORD=
# Backend Analytics Flags
BACKEND_ANALYTICS=
# Frontend variables
NEXT_PUBLIC_GA4_MEASUREMENT_ID=
@@ -136,7 +133,6 @@ Enable the app to Talk, Draw, and Google things up.
| **Browse** | |
| `PUPPETEER_WSS_ENDPOINT` | Puppeteer WebSocket endpoint - used for browsing (pade downloadeing), etc. |
| **Backend** | |
| `BACKEND_ANALYTICS` | Semicolon-separated list of analytics flags (see backend.analytics.ts). Flags: `domain` logs the responding domain. |
| `HTTP_BASIC_AUTH_USERNAME` | See the [Authentication](deploy-authentication.md) guide. Username for HTTP Basic Authentication. |
| `HTTP_BASIC_AUTH_PASSWORD` | Password for HTTP Basic Authentication. |
-23
View File
@@ -1,23 +0,0 @@
import { track } from '@vercel/analytics/server';
import { env } from '~/server/env.mjs';
// all the backend analytics flags
type BackendAnalyticsFlag =
| 'domain'; // logs which domain the initial (capabilities) request is sent to
const checkAnalyticsFlag = (flag: BackendAnalyticsFlag): boolean =>
env.BACKEND_ANALYTICS?.includes(flag) || false;
export function analyticsListCapabilities(backendHostName: string) {
if (checkAnalyticsFlag('domain')) {
// Note: fire-and-forget
void track('backend-domain', {
hostname: backendHostName,
vercel_url: process.env.VERCEL_URL || 'no-vercel',
});
}
}
+1 -4
View File
@@ -9,8 +9,6 @@ import { fetchJsonOrTRPCThrow } from '~/server/api/trpc.router.fetchers';
// critical to make sure we `import type` here
import type { BackendCapabilities } from './store-backend-capabilities';
import { analyticsListCapabilities } from './backend.analytics';
function sdbmHash(str: string): string {
let hash = 0;
@@ -48,8 +46,7 @@ export const backendRouter = createTRPCRouter({
/* List server-side capabilities (pre-configured by the deployer) */
listCapabilities: publicProcedure
.query(async ({ ctx }): Promise<BackendCapabilities> => {
analyticsListCapabilities(ctx.hostName);
.query(async ({ ctx: _unused }): Promise<BackendCapabilities> => {
return {
// llms
hasLlmAnthropic: !!env.ANTHROPIC_API_KEY,
-3
View File
@@ -86,9 +86,6 @@ export const env = createEnv({
HTTP_BASIC_AUTH_USERNAME: z.string().optional(),
HTTP_BASIC_AUTH_PASSWORD: z.string().optional(),
// Backend: Analytics flags (e.g. which hostname responds) for managed installs
BACKEND_ANALYTICS: z.string().optional().transform(list => (list || '').split(';').filter(flag => !!flag)),
// Build-time configuration (ignore)
BIG_AGI_BUILD: z.enum(['standalone', 'static']).optional(),