Skip to content

feat: qlog no-log header for replay traffic#35

Open
andreimarinescu wants to merge 1 commit into
mainfrom
feat/qlog-no-log-header
Open

feat: qlog no-log header for replay traffic#35
andreimarinescu wants to merge 1 commit into
mainfrom
feat/qlog-no-log-header

Conversation

@andreimarinescu

Copy link
Copy Markdown
Collaborator

Adds COSIFT_QLOG_NOLOG_TOKEN: when set, a query request whose X-Cosift-No-Log header exactly equals the token is served normally but not written to the query log. Unset token = feature off (header ignored).

Motivation: the demand-loop's weekly replay batch re-issues logged queries against /search to measure servedness. Without an exclusion mechanism those replays land back in the query log and become next cycle's "demand" — the loop pollutes its own signal. This is engine ask #2 (variant B) from the demand-loop design.

Notes:

  • Suppression is log-only: count/rateLimit wrappers still apply, response is unchanged apart from X-Cosift-Query-Id (not minted for suppressed requests; the qid only feeds feedback⋈qlog joins, which can't include unlogged rows anyway).
  • Exact string match, no trimming — clients send the token verbatim. Plain compare mirrors the requireAdmin precedent.
  • Only effective when COSIFT_QUERY_LOG is set; the production passthrough worker's D1 log needs the equivalent header check separately (coordinated with Teo).
  • docs/ENV.md updated; table test covers set/unset token × header present/wrong/absent.

Requests whose X-Cosift-No-Log header equals COSIFT_QLOG_NOLOG_TOKEN are
served normally but skipped in the query log, so demand-loop replay traffic
can be excluded. Unset token = feature off. Plain string compare mirrors the
requireAdmin precedent.
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