Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/reduce-otel-ingestion-log-volume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Move per-batch ClickHouse event-insert logs to the debug level to cut default log volume, and add an `HTTP_ACCESS_LOG_DISABLED` env var that suppresses successful (2xx) HTTP access logs while still logging errors.
2 changes: 1 addition & 1 deletion apps/webapp/app/eventLoopMonitor.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function startEventLoopUtilizationMonitoring() {
const utilization = Number.isFinite(diff.utilization) ? diff.utilization : 0;

if (Math.random() < env.EVENT_LOOP_MONITOR_UTILIZATION_SAMPLE_RATE) {
logger.info("nodejs.event_loop.utilization", { utilization });
logger.debug("nodejs.event_loop.utilization", { utilization });
}

lastEventLoopUtilization = currentEventLoopUtilization;
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/v3/dynamicFlushScheduler.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class DynamicFlushScheduler<T> {
if (newConcurrency !== currentConcurrency) {
this.limiter = pLimit(newConcurrency);

this.logger.info("Adjusted flush concurrency", {
this.logger.debug("Adjusted flush concurrency", {
previousConcurrency: currentConcurrency,
newConcurrency,
queuePressure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class ClickhouseEventRepository implements IEventRepository {
return;
}

logger.info("ClickhouseEventRepository.flushBatch Inserted batch into clickhouse", {
logger.debug("ClickhouseEventRepository.flushBatch Inserted batch into clickhouse", {
events: events.length,
insertResult: outcome.insertResult,
sanitized: outcome.kind === "sanitized",
Expand Down Expand Up @@ -302,7 +302,7 @@ export class ClickhouseEventRepository implements IEventRepository {
return;
}

logger.info("ClickhouseEventRepository.flushLlmMetricsBatch Inserted LLM metrics batch", {
logger.debug("ClickhouseEventRepository.flushLlmMetricsBatch Inserted LLM metrics batch", {
rows: rows.length,
sanitized: outcome.kind === "sanitized",
});
Expand Down Expand Up @@ -421,7 +421,7 @@ export class ClickhouseEventRepository implements IEventRepository {
throw insertError;
}

logger.info("ClickhouseEventRepository.flushOtelMetricsBatch Inserted OTLP metrics batch", {
logger.debug("ClickhouseEventRepository.flushOtelMetricsBatch Inserted OTLP metrics batch", {
rows: rows.length,
});
});
Expand Down
11 changes: 10 additions & 1 deletion apps/webapp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,16 @@ if (ENABLE_CLUSTER && cluster.isPrimary) {
// more aggressive with this caching.
app.use(express.static("public", { maxAge: "1h" }));

app.use(morgan("tiny"));
// On high-volume machine-ingest services (e.g. otel) the per-request access
// log dominates log volume. HTTP_ACCESS_LOG_DISABLED suppresses successful
// (2xx) access logs; non-2xx responses are always logged so errors stay visible.
const suppressSuccessfulAccessLogs = process.env.HTTP_ACCESS_LOG_DISABLED === "1";
app.use(
morgan("tiny", {
skip: (_req, res) =>
suppressSuccessfulAccessLogs && res.statusCode >= 200 && res.statusCode < 300,
})
);

process.title = ENABLE_CLUSTER
? `node webapp-worker-${cluster.isWorker ? cluster.worker?.id : "solo"}`
Expand Down