mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:51:57 +00:00
search: observe the marshalled size of queries to zoekt (#45324)
Wanted to inspect this data the other day. Test Plan: go test
This commit is contained in:
parent
b2ccce8885
commit
aeb3292416
@ -97,6 +97,14 @@ func (m *meteredSearcher) StreamSearch(ctx context.Context, q query.Q, opts *zoe
|
||||
event.AddLogFields(fields)
|
||||
}
|
||||
|
||||
// We wrap our queries in GobCache, this gives us a convenient way to find
|
||||
// out the marshalled size of the query.
|
||||
if gobCache, ok := q.(*query.GobCache); ok {
|
||||
b, _ := gobCache.GobEncode()
|
||||
tr.LogFields(log.Int("query.size", len(b)))
|
||||
event.AddField("query.size", len(b))
|
||||
}
|
||||
|
||||
if isLeaf && opts != nil && policy.ShouldTrace(ctx) {
|
||||
// Replace any existing spanContext with a new one, given we've done additional tracing
|
||||
spanContext := make(map[string]string)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user