Add request logging to verify blocked requests never reach the server

Aperta
#14 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@VISHNU0906 ci sta già lavorando.

Dal 9/11/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start with server.go, the provider handlers such as openai.go, and cmd/mockllm/main.go to map request handling, startup health checks, and CLI configuration. Define how a recorder or callback will capture every LLM request and expose a fresh test baseline, then document the gateway rejection workflow with a positive control. Done means tests show successful, unmatched, malformed, and streaming requests are recorded with timestamp, method, path, and status, while health checks can be distinguished or filtered.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Use case

During security testing, a gateway or policy should reject certain requests before they reach the upstream LLM. When mockllm is that upstream, I need server-side evidence that it received zero LLM requests during the test. A client-side rejection alone does not establish this.

Current behavior

Reviewed main at 35792a0:

  • server.go registers handlers without access-log middleware and exposes no received-request history or count. Its health response reports configured mock counts.
  • The provider handlers do not record every received request. For example, openai.go includes an unmatched request in the HTTP error response to the client; this is not a server-side request log.
  • The CLI has no request-logging option.

Requested capability

Add request logging usable from both the standalone server and embedded Go tests:

  • Record every received LLM API request, including successful, unmatched, and malformed requests, across all supported providers and streaming modes.
  • Include timestamp, method, path, and response status in structured entries. Request bodies and credential headers are unnecessary for the zero-request assertion.
  • Provide a test-friendly way to inspect or count received requests within a defined test window, such as a recorder/callback with a reset or baseline.
  • Make health checks distinguishable or filterable, including the server's own startup /health probe.

Expected validation

A positive-control request produces a visible entry/count. After establishing a fresh baseline, a request rejected by the gateway leaves the upstream LLM request count at zero for the test window. Document this workflow with an example.

Lingua principale
Go
Stelle
6
Fork
6
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.