Skip to content

Commit edea7df

Browse files
committed
chore(analytics): remove Profound request tracking
1 parent bd7995e commit edea7df

3 files changed

Lines changed: 10 additions & 139 deletions

File tree

apps/sim/lib/analytics/profound.ts

Lines changed: 0 additions & 119 deletions
This file was deleted.

apps/sim/lib/core/config/env.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ export const env = createEnv({
301301
TELEMETRY_ENDPOINT: z.string().url().optional(), // Custom telemetry/analytics endpoint
302302
COST_MULTIPLIER: z.number().optional(), // Multiplier for cost calculations
303303
LOG_LEVEL: z.enum(['DEBUG', 'INFO', 'WARN', 'ERROR']).optional(), // Minimum log level to display (defaults to ERROR in production, DEBUG in development)
304-
PROFOUND_API_KEY: z.string().min(1).optional(), // Profound analytics API key
305-
PROFOUND_ENDPOINT: z.string().url().optional(), // Profound analytics endpoint
306304
GRAFANA_OTLP_ENDPOINT: z.string().url().optional(), // Grafana Cloud OTLP HTTP gateway base URL (e.g., https://otlp-gateway-prod-us-east-0.grafana.net/otlp). Trigger.dev exporters append /v1/traces, /v1/logs, /v1/metrics.
307305
GRAFANA_OTLP_HEADERS: z.string().min(1).optional(), // Comma-separated key=value headers for OTLP requests (e.g., "Authorization=Basic <base64(instanceId:token)>"). Same format as the OTEL_EXPORTER_OTLP_HEADERS spec.
308306
GRAFANA_DEPLOYMENT_ENVIRONMENT: z.string().min(1).optional(), // Deployment tier label (e.g., "production", "staging", "development"). Emitted as the stable `deployment.environment.name` resource attribute on Trigger.dev telemetry to match the rest of the Sim OTEL stack.

apps/sim/proxy.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createLogger } from '@sim/logger'
22
import { getSessionCookie } from 'better-auth/cookies'
33
import { type NextRequest, NextResponse } from 'next/server'
4-
import { sendToProfound } from './lib/analytics/profound'
54
import { getEnv } from './lib/core/config/env'
65
import { isAuthDisabled, isDev, isHosted } from './lib/core/config/env-flags'
76
import { generateRuntimeCSP } from './lib/core/security/csp'
@@ -316,40 +315,40 @@ export async function proxy(request: NextRequest) {
316315
const hasActiveSession = isAuthDisabled || !!sessionCookie
317316

318317
const redirect = handleRootPathRedirects(request, hasActiveSession)
319-
if (redirect) return track(request, redirect)
318+
if (redirect) return applyIndexingPolicy(request, redirect)
320319

321320
if (url.pathname === '/login' || url.pathname === '/signup') {
322321
if (hasActiveSession) {
323-
return track(request, NextResponse.redirect(new URL('/workspace', request.url)))
322+
return applyIndexingPolicy(request, NextResponse.redirect(new URL('/workspace', request.url)))
324323
}
325324
const response = NextResponse.next()
326325
response.headers.set('Content-Security-Policy', generateRuntimeCSP())
327326
response.headers.set('X-Content-Type-Options', 'nosniff')
328327
response.headers.set('X-Frame-Options', 'SAMEORIGIN')
329-
return track(request, response)
328+
return applyIndexingPolicy(request, response)
330329
}
331330

332331
// Chat pages are publicly accessible embeds — CSP is set in next.config.ts headers
333332
if (url.pathname.startsWith('/chat/')) {
334-
return track(request, NextResponse.next())
333+
return applyIndexingPolicy(request, NextResponse.next())
335334
}
336335

337336
if (url.pathname.startsWith('/workspace')) {
338337
if (!hasActiveSession) {
339-
return track(request, NextResponse.redirect(new URL('/login', request.url)))
338+
return applyIndexingPolicy(request, NextResponse.redirect(new URL('/login', request.url)))
340339
}
341340
const response = NextResponse.next()
342341
response.headers.set('Content-Security-Policy', generateRuntimeCSP())
343342
response.headers.set('X-Content-Type-Options', 'nosniff')
344343
response.headers.set('X-Frame-Options', 'SAMEORIGIN')
345-
return track(request, response)
344+
return applyIndexingPolicy(request, response)
346345
}
347346

348347
const invitationRedirect = handleInvitationRedirects(request, hasActiveSession)
349-
if (invitationRedirect) return track(request, invitationRedirect)
348+
if (invitationRedirect) return applyIndexingPolicy(request, invitationRedirect)
350349

351350
const securityBlock = handleSecurityFiltering(request)
352-
if (securityBlock) return track(request, securityBlock)
351+
if (securityBlock) return applyIndexingPolicy(request, securityBlock)
353352

354353
const response = NextResponse.next()
355354
response.headers.set('Vary', 'User-Agent')
@@ -358,7 +357,7 @@ export async function proxy(request: NextRequest) {
358357
response.headers.set('X-Content-Type-Options', 'nosniff')
359358
response.headers.set('X-Frame-Options', 'SAMEORIGIN')
360359

361-
return track(request, response)
360+
return applyIndexingPolicy(request, response)
362361
}
363362

364363
/**
@@ -370,7 +369,7 @@ export async function proxy(request: NextRequest) {
370369
* the index. robots.txt is excluded from this proxy's matcher so it keeps
371370
* serving the crawlable rules this header depends on.
372371
*/
373-
function applyIndexingPolicy(request: NextRequest, response: NextResponse): void {
372+
function applyIndexingPolicy(request: NextRequest, response: NextResponse): NextResponse {
374373
const host =
375374
request.headers.get('x-forwarded-host')?.split(',')[0]?.trim() ||
376375
request.headers.get('host') ||
@@ -379,14 +378,7 @@ function applyIndexingPolicy(request: NextRequest, response: NextResponse): void
379378
if (isNonCanonicalSimHost(host)) {
380379
response.headers.set('X-Robots-Tag', 'noindex, nofollow')
381380
}
382-
}
383381

384-
/**
385-
* Sends request data to Profound analytics (fire-and-forget) and returns the response.
386-
*/
387-
function track(request: NextRequest, response: NextResponse): NextResponse {
388-
applyIndexingPolicy(request, response)
389-
sendToProfound(request, response.status)
390382
return response
391383
}
392384

0 commit comments

Comments
 (0)