Skip to content

insights: Add endpoint for getting related insights inline

Warren Gifford requested to merge insights/prototype-inline-insights into main

Created by: CristinaBirkel

Closes https://github.com/sourcegraph/sourcegraph/issues/39121

Description

This is a prototype to enable inline links to insights. We'll be able to see if devs find this feature useful as part of their core workflow. The main caveat here is that this is slow. In my testing it takes roughly 15s to match against 50 series. It's slow because it's making that many search queries as part of aggregating the results. We'll need to keep an eye on performance degradation on the instance when this feature is eventually turned on. We only expect this endpoint to be used on the file view--not on the main search page--and to be hidden behind a feature flag.

Test plan

You can test this out locally with a query similar to:

query {
    relatedInsightsInline(input: {
        file: "enterprise/internal/insights/query/querybuilder/builder.go"
        revision: "a84fde5e35eed41060acb6aa46b842af32133027",
        repo: "github.com/sourcegraph/sourcegraph"}) 
    {
        viewId, title, lineNumbers
    }
}

Merge request reports

Loading