insights: fix bug where JIT capture groups return values only for 1 repo
Created by: leonore
closes #35602 (closed), see the issue for more details + findings.
When collating the data together for all repos we were re-initialising the pivoted value at each timestamp on each iteration, essentially only keeping the data for the last repo search.
Test plan
Tested manually by creating an insight and checking correctness, and checking the values returned by GetInsightView
on the graphQL API.
- Create a JIT capture group insight: https://sourcegraph.test:3443/insights/create/capture-group?dashboardId=all
- The query I picked was
var\(--(color-bg-\d)\)
for ease of correctness checking. - Add these repos:
github.com/sourcegraph/about, github.com/sourcegraph/sourcegraph, github.com/sourcegraph-testing/demo-sourcegraph
(add them indev-private/external-services-config.json
if required - Compare values to search queries
If you run this locally you can see that for the individual queries and individual repos they are correct as well.
For GraphQL, the following query:
query GetInsightView($id: ID, $filters: InsightViewFiltersInput) {
insightViews(id: $id, filters: $filters) {
nodes {
...InsightDataNode
__typename
}
__typename
}
}
fragment InsightDataNode on InsightView {
id
dataSeries {
...InsightDataSeries
__typename
}
__typename
}
fragment InsightDataSeries on InsightsSeries {
seriesId
label
points {
dateTime
value
__typename
}
status {
backfillQueuedAt
completedJobs
pendingJobs
failedJobs
__typename
}
__typename
}
with the id of the insight you have just created, returns correct values as well.