Skip to content

Open-source status page, incident response and uptime monitoring

decrease sampling (#1752)

Thibault Le Ouaycd3f10805a43
diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts
index cc363deaf..f5852b35f 100644
--- a/apps/server/src/index.ts
+++ b/apps/server/src/index.ts
@@ -37,8 +37,8 @@ function shouldSample(event: Record<string, any>): boolean {
// Always keep slow requests (above p99)
if (event.duration_ms > 2000) return true;
- // Random sample the rest at 5%
- return Math.random() < 0.05;
+ // Random sample the rest at 20%
+ return Math.random() < 0.2;
}
const defaultLogger = getOpenTelemetrySink({
@@ -97,10 +97,10 @@ app.use("*", async (c, next) => {
await withContext(
{
- requestId,
+ request_id: requestId,
method: c.req.method,
url: c.req.url,
- userAgent: c.req.header("User-Agent"),
+ user_agent: c.req.header("User-Agent"),
},
async () => {
// Initialize wide event - one canonical log line per request
diff --git a/apps/workflows/src/index.ts b/apps/workflows/src/index.ts
index 138836e22..5954b017d 100644
--- a/apps/workflows/src/index.ts
+++ b/apps/workflows/src/index.ts
@@ -56,8 +56,8 @@ function shouldSample(event: Record<string, unknown>): boolean {
return true;
}
- // Random sample successful, fast requests at 5%
- return Math.random() < 0.05;
+ // Random sample successful, fast requests at 20%
+ return Math.random() < 0.2;
}
const defaultLogger = getOpenTelemetrySink({
@@ -115,10 +115,10 @@ app.use("*", async (c, next) => {
await withContext(
{
- requestId,
+ request_id: requestId,
method: c.req.method,
url: c.req.url,
- userAgent: c.req.header("User-Agent"),
+ user_agent: c.req.header("User-Agent"),
// ipAddress: c.req.header("CF-Connecting-IP") || c.req.header("X-Forwarded-For")
},
async () => {