feat(graph): per-node timing + datastore-read attribution in the check debug trace (internal proto)#3199
Open
poucet wants to merge 1 commit into
Open
feat(graph): per-node timing + datastore-read attribution in the check debug trace (internal proto)#3199poucet wants to merge 1 commit into
poucet wants to merge 1 commit into
Conversation
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
…eck debug trace Adds start_time and datastore_queries to the internal dispatch CheckDebugTrace so a single Check / CheckBulk debug trace can answer two questions that duration alone cannot: (1) whether sub-problems were traversed concurrently, and (2) where time was spent blocked on datastore reads. start_time is the wall-clock anchor for each node (the monotonic duration stays authoritative; end = start_time + duration). A context-scoped, concurrency-safe collector is installed per dispatch node; the observable datastore proxy records each relationship query (shape, start, duration, row count) into it, so reads attribute to the node that issued them. Both only activate when debug tracing is enabled, leaving the non-debug hot path untouched. This is the internal-proto-only slice; the public authzed/api CheckDebugTrace fields and the internal->public conversion follow once that field lands. Refs authzed#3198
28f7adc to
181d295
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two pieces of timing to the internal dispatch
CheckDebugTraceso asingle
Check/CheckBulkdebug trace (--with-tracing) can answer twoquestions that
durationalone cannot:wall-clock
start_time; combined with the existing authoritativeduration,every dispatch node lands on one absolute time axis, so sibling overlap (or
serialization behind the concurrency limit) is reconstructable.
repeated DatastoreQuery datastore_queries—{query_shape, start_time, duration, relationship_count}for the relationship reads that node issueditself. Per-query events (not one summed number) because a node can issue
concurrent reads, so the events show overlap instead of hiding it.
Implements the internal-proto slice of #3198.
How
proto/internal/dispatch/v1/dispatch.proto:CheckDebugTrace.start_time(9),CheckDebugTrace.datastore_queries(10), and a newDatastoreQuerymessage.internal/dstrace: a small leaf package with a context-scoped,mutex-guarded
Collector(a node may issue concurrent reads).internal/graph/check.go: whenDebug != NO_DEBUG, install a fresh collectorper node (dispatched children re-enter
Checkand install their own, so readsattribute to the node that issued them), and stamp
start_time+datastore_queriesnext to the existingduration.internal/datastore/proxy/observable.go: the proxy already times each queryfrom issue until the iterator is fully drained; it now also records that
observation into the collector when one is present. This is a single
conditional branch and a no-op when debug tracing is off.
Scope / follow-up
Internal-proto only. The public
authzed.api.v1.CheckDebugTracefields(
start_time/end_time/datastore_queries) live inauthzed/apiand mustland + be published there before the buf dep can be bumped and
internal/services/v1/debug.goconvertCheckTracecan surface them. Theinternal trace already round-trips through
DebugInfo, so the approach is fullyexercised end-to-end here.
Tests
internal/dstrace: collector unit tests (recording, concurrency safety,nil-safety, nested independence).
internal/datastore/proxy/observable_test.go: proxy records query events(forward + reverse) into a context collector; no-op without one.
internal/graph/computed: an integration test wrapping memdb in theobservable proxy and running a multi-hop check with trace debugging, then
walking the dispatch trace to assert every executed node has a
start_timeand that datastore reads are attributed as
DatastoreQueryevents.Compatibility
New fields only (9/10 internal);
buf breaking ... use: WIREpasses.durationis unchanged and remains authoritative. The collector and the proxy branch only
activate under debug tracing, so the non-debug hot path is untouched.