Skip to content

Code Insights: Include backend insights in insights count metric/ping

Administrator requested to merge vk/include-be-insight-count-in-analytics into main

Created by: vovakulikov

Closes https://github.com/sourcegraph/sourcegraph/issues/24177 Closes https://github.com/sourcegraph/sourcegraph/issues/24178

Context

Historically we had been pinging the only extension-based insights which are stored as top-level properties in the setting cascade subjects. But since we introduced Backend Insights which are stored under the insights.allrepos key in subjects settings we should take into account this info too to be able to count insights properly.

This PR adds logic to count backend insights with extension-based insights and at the same time extend ping counting event with new explicit info about extension and backend-based insights.

interface InsightGroups {
    codeStatsInsights: number
    
    // All search insights extension-based + backend-based
    searchBasedInsights: number
    
    // Explicit number of backend based insights
    searchBasedBackendInsights: number
    
    // Explicit number of extension based insights
    searchBasedExtensionInsights: number
}

Note that all insights are counted only from shared places like org-level settings or global site-wide settings. Personal insights don't count. This logic about this was introduced in this RFC about Code Insights Pings

of current insights that are org-visible by week, by type of insight – the # of insights that are org-wide in visibility (note: if there are 4 one week, then one more is created, the next week of data should show 5. This metric is not measuring an org-visible insight just on the week it is created) This helps us understand if folks are sharing insights at all or just experimenting on their own

Merge request reports

Loading