Openstatus www.openstatus.dev

decrease sampling (#1752)

authored by

Thibault Le Ouay and committed by
GitHub
cd3f1080 e17b6a6a

+8 -8
+4 -4
apps/server/src/index.ts
··· 37 37 // Always keep slow requests (above p99) 38 38 if (event.duration_ms > 2000) return true; 39 39 40 - // Random sample the rest at 5% 41 - return Math.random() < 0.05; 40 + // Random sample the rest at 20% 41 + return Math.random() < 0.2; 42 42 } 43 43 44 44 const defaultLogger = getOpenTelemetrySink({ ··· 97 97 98 98 await withContext( 99 99 { 100 - requestId, 100 + request_id: requestId, 101 101 method: c.req.method, 102 102 url: c.req.url, 103 - userAgent: c.req.header("User-Agent"), 103 + user_agent: c.req.header("User-Agent"), 104 104 }, 105 105 async () => { 106 106 // Initialize wide event - one canonical log line per request
+4 -4
apps/workflows/src/index.ts
··· 56 56 return true; 57 57 } 58 58 59 - // Random sample successful, fast requests at 5% 60 - return Math.random() < 0.05; 59 + // Random sample successful, fast requests at 20% 60 + return Math.random() < 0.2; 61 61 } 62 62 63 63 const defaultLogger = getOpenTelemetrySink({ ··· 115 115 116 116 await withContext( 117 117 { 118 - requestId, 118 + request_id: requestId, 119 119 method: c.req.method, 120 120 url: c.req.url, 121 - userAgent: c.req.header("User-Agent"), 121 + user_agent: c.req.header("User-Agent"), 122 122 // ipAddress: c.req.header("CF-Connecting-IP") || c.req.header("X-Forwarded-For") 123 123 }, 124 124 async () => {