audio streaming app plyr.fm
38
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: BROWSER_OBSERVABILITY env var to toggle browser telemetry proxy (#1288)

the logfire browser SDK proxies all browser trace data through the
backend (POST /logfire-proxy/v1/traces) because Logfire requires
server-side auth. the proxy uses run_in_threadpool for a synchronous
HTTP call — under load, this saturates the threadpool and starves
async handlers including DB queries.

adds BROWSER_OBSERVABILITY env var (default: true) exposed via
GET /config. frontend gates initObservability() on this flag.
set BROWSER_OBSERVABILITY=false to disable browser telemetry proxy
and eliminate the proxy load on the backend.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

authored by

nate nowack
Claude Opus 4.6 (1M context)
and committed by
GitHub
e7847684 aa939af2

+15 -3
+1
backend/src/backend/api/meta.py
··· 29 29 return { 30 30 "max_upload_size_mb": settings.storage.max_upload_size_mb, 31 31 "max_image_size_mb": 20, # hardcoded limit for cover art 32 + "browser_observability": settings.app.browser_observability, 32 33 "default_hidden_tags": DEFAULT_HIDDEN_TAGS, 33 34 "bufo_exclude_patterns": list(settings.bufo.exclude_patterns), 34 35 "bufo_include_patterns": list(settings.bufo.include_patterns),
+5
backend/src/backend/config.py
··· 123 123 default=60, 124 124 description="Interval for background tasks in seconds", 125 125 ) 126 + browser_observability: bool = Field( 127 + default=True, 128 + validation_alias="BROWSER_OBSERVABILITY", 129 + description="Enable browser telemetry proxy (logfire-proxy endpoint). Disable to reduce backend load from browser trace forwarding.", 130 + ) 126 131 broadcast_channel_prefix: str = Field( 127 132 default="plyr", 128 133 description="Prefix used for browser BroadcastChannel identifiers",
+1
frontend/src/lib/config.ts
··· 16 16 interface ServerConfig { 17 17 max_upload_size_mb: number; 18 18 max_image_size_mb: number; 19 + browser_observability: boolean; 19 20 default_hidden_tags: string[]; 20 21 bufo_exclude_patterns: string[]; 21 22 bufo_include_patterns: string[];
+7 -2
frontend/src/routes/+layout.svelte
··· 26 26 import { search } from '$lib/search.svelte'; 27 27 import { browser } from '$app/environment'; 28 28 import { initObservability } from '$lib/observability'; 29 + import { getServerConfig } from '$lib/config'; 29 30 let { children } = $props<{ children: any }>(); 30 31 let showQueue = $state(false); 31 32 ··· 59 60 // initialize auth and preferences once on mount (not on every navigation) 60 61 // this prevents repeated /auth/me calls for unauthenticated users 61 62 onMount(async () => { 62 - // set up browser observability before any fetch calls 63 - initObservability(); 63 + // set up browser observability if enabled by backend config 64 + getServerConfig() 65 + .then((config) => { 66 + if (config.browser_observability) initObservability(); 67 + }) 68 + .catch(() => {}); 64 69 65 70 // fetch sensitive images client-side (small payload, fast) 66 71 moderation.initialize();
+1 -1
loq.toml
··· 132 132 133 133 [[rules]] 134 134 path = "frontend/src/routes/+layout.svelte" 135 - max_lines = 749 135 + max_lines = 750 136 136 137 137 [[rules]] 138 138 path = "frontend/src/routes/costs/+page.svelte"