Skip to content

insights: return errors in compute stream

Warren Gifford requested to merge insights/compute-stream-errors into main

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

  1. 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”}
  1. and also when creating a JIT insight:
image

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

Merge request reports

Loading