Skip to content
Closed
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
10 changes: 8 additions & 2 deletions cloudflare-gastown/container/src/control-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,17 @@ app.use('*', async (c, next) => {
await next();
});

// Log method, path, status, and duration for every request
/** Paths polled too frequently to log on every request. */
const QUIET_PATHS = new Set(['/health']);

// Log method, path, status, and duration for every request (except noisy health polls)
app.use('*', async (c, next) => {
const path = c.req.path;
if (QUIET_PATHS.has(path)) {
return next();
}
const start = performance.now();
const method = c.req.method;
const path = c.req.path;
console.log(`[control-server] --> ${method} ${path}`);
await next();
const duration = (performance.now() - start).toFixed(1);
Expand Down
6 changes: 6 additions & 0 deletions kiloclaw/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ function flyProxyUrl(appName: string, url: URL): string {
// Named middleware functions
// =============================================================================

/** Paths that fire too frequently to log on every request (health checks, telemetry). */
const QUIET_PATHS = new Set(['/global/health', '/global/telemetry']);

async function logRequest(c: Context<AppEnv>, next: Next) {
const url = new URL(c.req.url);
if (QUIET_PATHS.has(url.pathname)) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Quiet-path check does not suppress the later proxy logs

This guard skips the top-level [REQ] line, but /global/health and /global/telemetry still hit the unconditional [PROXY] Handling request, [HTTP] Proxying, and [HTTP] Response status logs later in app.all('*', ...). The high-frequency polls will still flood worker logs, so this does not fully deliver the noise reduction described in the PR.

return next();
}
const redactedSearch = redactSensitiveParams(url);
console.log(`[REQ] ${c.req.method} ${url.pathname}${redactedSearch}`);
await next();
Expand Down
Loading