[gold] /json/v2/expectations RPC: Log baseline size and whether it was cached.
The Chrome folks have observed that sometimes goldctl falsely reports that a digest is untriaged. For example, in this task[1] goldctl reports:
warning: got empty expectations when querying https://chrome-gold.skia.org/json/v2/expectations?issue=4075226&crs=gerrit
However, the baseline is not empty.
This CL adds some extra information to the "fetchBaseline" trace, which should help determine the cause of this issue.
[1] https://ci.chromium.org/ui/p/chromium/builders/try/linux-chromeos-rel/1403643/test-results?sortby=&groupby=&q=ExactID%3Aninja%3A%2F%2Fash%3Aash_pixeltests%2FAppListItemViewPixelTest.AppListItemView%2FAll.4+VHash%3A4a9dc8330285b99c
Bug: skia:13980
Change-Id: If0af056a90d4b738b81d14ac4f3b4e3c0ebbbec8
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/633507
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/golden/go/web/web.go b/golden/go/web/web.go
index 5e1c313..d442a03 100644
--- a/golden/go/web/web.go
+++ b/golden/go/web/web.go
@@ -1959,13 +1959,18 @@
ctx, span := trace.StartSpan(ctx, "fetchBaseline")
defer span.End()
+ trace.BoolAttribute("fromCache", false)
+
// Return the baseline from the cache if possible.
baselineCacheKey := "primary"
if clID != "" {
baselineCacheKey = fmt.Sprintf("%s_%s", crs, clID)
}
if val, ok := wh.baselineCache.Get(baselineCacheKey); ok {
- return val.(frontend.BaselineV2Response), nil
+ res := val.(frontend.BaselineV2Response)
+ trace.BoolAttribute("fromCache", true)
+ trace.Int64Attribute("numExpectationsReturned", int64(len(res.Expectations)))
+ return res, nil
}
statement := `WITH
@@ -2034,6 +2039,7 @@
ChangelistID: clID,
Expectations: baseline,
}
+ trace.Int64Attribute("numExpectationsReturned", int64(len(response.Expectations)))
// Cache the computed baseline.
baselineCacheEntryTTL := baselineCachePrimaryBranchEntryTTL