Documentation
¶
Overview ¶
Command tracecheck is the trace-coverage gate: it fails the build when a code path that should be visible in a trace is not.
Why this exists: the gazetteer feature shipped six public service methods with no spans at all. Nothing was broken, every test passed, and the gap only surfaced when a trace of a slow request showed 828 of 829 ms as empty space. Instrumentation has no failing test to protect it, so it needs a gate instead.
Two rules, both derived from the code rather than an allowlist, so a newly added method is covered the moment it is written:
Every exported method on an application service that takes a context.Context must open a span — directly, or through a helper in the same package that opens one (e.g. gazetteer's beginSection).
Every method of a Traced* decorator in the adapters must open a span, and each decorator must carry a compile-time assertion that it satisfies its port interface. The assertion is what turns "the port grew a method and the decorator silently stopped covering it" into a compile error.
Usage: go run ./tools/tracecheck [rootdir]