Skip to content

chore(gastown): remove manual request logging middleware#3158

Open
jrf0110 wants to merge 1 commit intogastown-stagingfrom
chore/gastown-remove-request-logging-v2
Open

chore(gastown): remove manual request logging middleware#3158
jrf0110 wants to merge 1 commit intogastown-stagingfrom
chore/gastown-remove-request-logging-v2

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented May 9, 2026

Summary

Removes the redundant request-logging middleware from gastown.worker.ts that logged every HTTP request twice (incoming + outgoing) via logger.info(). This is already covered by the per-route instrumented(c, route, handler) wrapper from analytics.middleware.ts which emits structured AE events with route, userId, townId, rigId, agentId, beadId, durationMs, and error for every wrapped route.

Two pieces removed:

  1. The import { logger } from './util/log.util' line (now unused at the worker level)
  2. The entire request-logging middleware block (regex constants + app.use('*', ...) with logger.setTags, logger.info calls)

Preserved: timingMiddleware and useWorkersLogger middleware — these are independent infrastructure that other code depends on.

Verification

Manual review of the diff confirms 30 lines deleted, 0 added, single file modified.

Visual Changes

N/A

Reviewer Notes

The logger.setTags call from URL regexes is safe to remove — those tags were only consumed by the two logger.info lines being removed. Auth middleware already sets orgId/userId tags via JWT-derived values. Town.do.ts runs in a separate isolate and does its own setTags.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 9, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

This is a clean deletion of redundant request-logging middleware. The removed code:

  • Duplicated what instrumented() already covers (per-route structured AE events with all the relevant IDs and duration)
  • The logger import is fully removed and no longer referenced anywhere in the file
  • timingMiddleware and useWorkersLogger are correctly preserved
Files Reviewed (1 file)
  • services/gastown/src/gastown.worker.ts — 0 issues

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-4.6 · 220,254 tokens

@jrf0110 jrf0110 changed the base branch from main to gastown-staging May 10, 2026 00:08
Comment on lines -193 to -198
logger.setTags({
orgId: RE_ORG.exec(path)?.groups?.orgId,
townId: RE_TOWN.exec(path)?.groups?.townId,
rigId: RE_RIG.exec(path)?.groups?.rigId,
agentId: RE_AGENT.exec(path)?.groups?.agentId,
});
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.

It'd still be nice to set tags on requests, but maybe we can do it in a way more structured way like:

app.use('/api/towns/:townId', async (c, next) => {
  logger.setTags({ townId: c.req.param('townId' })
  await next()
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant