Add instrumentation-overhead NFR to OCR service #656
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
PR #653 added
/metricsto the OCR service viaprometheus-fastapi-instrumentatorplus a handful of domain counters anda per-page histogram observation. The instrumentator wraps every request
in a middleware and records bucketed durations; the histogram observations
on
/ocr/streamfire from inside the streaming generator.We have no agreed performance budget for this overhead. Without one, any
future regression (an extra label, a switch to summary-from-histogram, an
on-by-default tracing hook) cannot be evaluated against a target.
Proposal
Adopt a non-functional requirement, document it in
docs/architecture/NFRs.md(or wherever the existing NFRs live — needs asmall scout pass first) and add a CI check or a periodic load test that
fails when the budget is broken.
Suggested budget
The 5 ms figure is a starting point; calibrate from one baseline +
one instrumented run before locking it in.
Acceptance criteria
docs/architecture/NFRs.md(or wherever theexisting NFRs live).
scripts/perf/ocr-bench.shusing
wrkork6) that produces a JSON report.number to look at, what passes and what fails.
runner and posts a delta to the PR or to Grafana.
Out of scope
alert pattern — the same approach could be reused later).
Related
docs/adr/023-prometheus-instrumentator-and-metrics-registry-injection.md)