insights: return errors in compute stream
Created by: leonore
closes #34230 (closed)
- Returns hard errors and alerts in the compute stream
- Retrieve errors from insights when hitting the compute stream endpoint. Work on alerts will be done with #34651 (closed)
Test plan
To observe some errors I manually added an error fmt.Errorf("leo's error")
here
- Observed the error event by querying the compute endpoint:
curl -H 'Authorization: token [token]’ \
https://sourcegraph.test:3443/.api/compute/stream\?q\=repo:sourcegraph/sourcegraph%20test.
event: error
data: {“message”: “leo’s error”}
- and also when creating a JIT insight:
1 . and a backend insight, we see these logs:
[enterprise-worker] ERROR insights.queryrunner.workHandler, error: encountered error(s) while running a streaming compute search: [leo's error]
[enterprise-worker] WARN worker.insights-query-runner-job.background.worker.Handle workerutil/worker.go:365 Marked record as failed {"TraceId": "11133dcd4b990857", "SpanId": "2ba4751f7050620d", "Attributes": {"error": "encountered error(s) while running a streaming compute search: [leo's error]"}}
The insight will show No data to display