Stop writing three log events per nemar-api request
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend, observability
Research direction
Read backend/src/middleware/access-log.ts and its mount in backend/src/index.ts:155, then review sampling settings in backend/wrangler-sccn.toml:257-270 and rejection logging in backend/src/routes/data.ts:122-148. Check backend/test/access-log.test.ts for the existing logger expectation. Decide how to preserve diagnosable failures while reducing routine logs; done means comparable-traffic ingestion drops by at least two thirds and a deliberately failing request remains findable.
Written by the indexing model from the issue text.
Description
Part of #2633.
Every nemar-api request writes three Workers Logs events: the platform invocation log (about 4.3 KB each, eventSize 4348 on a sampled data request) and two lines from Hono's logger (<-- GET ... and --> GET ... 302 692ms) printed by accessLogger() in backend/src/middleware/access-log.ts, mounted for every request in backend/src/index.ts:155. The invocation log already records method, URL, status, wall and CPU time, so the two logger lines add nothing. backend/wrangler-sccn.toml:257-270 keeps head_sampling_rate = 1 and invocation_logs = true; its comment assumes "low QPS ... under the 200k events/day" cap, while data.nemar.org now serves 1M to 9M requests a day (53.5M on 2026-11-24).
November: 155.6M log events, $81.60. Current cycle: about 1.5 GB/day ingested under the volume pricing live since 2026-12-01 (50 GB/cycle included, then $0.25/GB).
Proposed: stop the per-request logger lines in production (keep the redaction for anything still logged), sample production logs (for example head_sampling_rate = 0.2), and quiet the per-request console.log rejections in backend/src/routes/data.ts:122-148, which fire once per bad id. Keep errors diagnosable (decide whether errors need a separate path, such as Analytics Engine counters, when sampled). backend/test/access-log.test.ts pins that the logger is mounted; update it with the decision.
Acceptance: observability ingestion per day in Billing falls by at least two thirds at comparable traffic; a deliberately failing request is still findable.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 4h 48m
- Merged PRs (30d)
- 468
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nemarOrg/nemar-cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
All issues in nemarOrg/nemar-cli
Similar issues
-
Codex使用可 かんたん コード
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ryuki-moro/Nicomaru#348 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day