Skip to content

insights: Add sorting metadata for insights

Administrator requested to merge insights/series-metadata into main

Created by: CristinaBirkel

Closes https://github.com/sourcegraph/sourcegraph/issues/34612 Closes https://github.com/sourcegraph/sourcegraph/issues/34653

Description

This PR adds in functionality for series options, namely sortMode, sortDirection and limit. The implementation mirrors the way we're doing repo/context filtering.

  1. Adds SeriesDisplayOptions to the graphql schema, which contains SortOptions and Limit. This can be passed into the insightViews query as an additional argument, and is also required for updates.
  2. Adds 3 new fields to the insight_view database schema for series_sort_mode, series_sort_direction, and series_limit. These are all nullable, which I think makes sense.
  3. Similar to default filters, insights will use overridden values if passed into insightViews, and will fall back on persisted data otherwise. As a fallback, defaults are used RESULT_COUNT, DESC, 20.

Test plan

This PR contains both FE/BE changes so the best way to test it out is via the UI! Use the new Sort and Limit filters on capture group insights (both recorded and JIT) and make sure the options are reflected in the chart.

Merge request reports

Loading