Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Code Insights: Add num samples display option#46653

Merged
vovakulikov merged 16 commits intomainfrom
vk/add-num-sample-ui-filter
Jan 20, 2023
Merged

Code Insights: Add num samples display option#46653
vovakulikov merged 16 commits intomainfrom
vk/add-num-sample-ui-filter

Conversation

@vovakulikov
Copy link
Contributor

@vovakulikov vovakulikov commented Jan 19, 2023

Closes https://github.com/sourcegraph/sourcegraph/issues/45823
Fixes https://github.com/sourcegraph/sourcegraph/issues/38926
Fixes https://github.com/sourcegraph/sourcegraph/issues/42459

Context

This PR adds yet another drill down filter field. Sort and Limit number points field, it works actually like max (limit) filter, points count on the chart can't be greater than filter value.

Screenshot 2023-01-19 at 00 31 50

Backend problem

  • Save default filters mutation doesn't actually save numSamples parameter
  • Default value is zero but schema says that it's nullable field (0 default value is weird even it wasn't nullable)

Test plan

  • Open the dashboard page with any insights
  • Open drill down filters (filter icon in the card)
  • Fill in sort and limit num of points field
  • Check that point numbers on the chart is equal or less than current value

App preview:

Check out the client app preview documentation to learn more.

@vovakulikov vovakulikov self-assigned this Jan 19, 2023
@cla-bot cla-bot bot added the cla-signed label Jan 19, 2023
@sg-e2e-regression-test-bob
Copy link

sg-e2e-regression-test-bob commented Jan 19, 2023

Bundle size report 📦

Initial size Total size Async size Modules
-0.00% (-0.00 kb) -0.01% (-1.08 kb) -0.01% (-1.08 kb) -0.14% (-1) 🔽

Look at the Statoscope report for a full comparison between the commits 268213b and 02c985e or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@leonore
Copy link
Contributor

leonore commented Jan 19, 2023

Save default filters mutation doesn't actually save numSamples parameter

yep that should be pending #46283 and #saving sort #42459

Default value is zero but schema says that it's nullable field (0 default value is weird even it wasn't nullable)

yeah, I agree a 0 default value is weird. We just need to align on what default we want to provide here- we don't have to make the field nullable on the backend but in that case we want to provide a useful default for every call from the frontend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make this non-nullable but in that case we should agree on a sensible default, like 30 which is the default max samples we save

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also to play both cases, the reason this is nullable is also so that if a user changes the sample size default then we return the max that they can see

@vovakulikov
Copy link
Contributor Author

@leonore @chwarwick I think this setting name is confusing, this doesn't work like setting where you specify number of points for each series, instead it works like upper boundary (exactly how it works for series numbers). For example, I have an insight with 12 points, when I type 20 in number samples field I still will get 12 points right? because there is no other points on the backend.

So I think we should

  • Rename this options to max number of series/points
  • Default on the backend to max possible value (I don't mind to have nullable fields for these settings actually)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this wording will make people think this is actually limiting captured history? Maybe something like:

Number of series points to display (max 90)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "Max number of series points to display" based on this comment https://github.com/sourcegraph/sourcegraph/pull/46653#issuecomment-1397451495

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, was just thinking it needed something that indicated it's just about the display

@vovakulikov vovakulikov force-pushed the vk/add-num-sample-ui-filter branch from 3797492 to f0117e0 Compare January 19, 2023 20:12
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jan 20, 2023

Codenotify: Notifying subscribers in CODENOTIFY files for diff 02c985e...268213b.

Notify File(s)
@sourcegraph/code-insights-backend enterprise/internal/insights/resolvers/insight_view_resolvers.go

Copy link
Contributor

@leonore leonore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty of changing the default in the backend in this PR, hope that's okay.

I tested this locally and couldn't reproduce the sort & limit filters not getting saved anymore- did you fix this in this PR? (if so can we add a changelog entry for that too?)

vovakulikov and others added 2 commits January 20, 2023 11:27
Co-authored-by: leo <leo.p@sourcegraph.com>
@vovakulikov vovakulikov merged commit 56a19bc into main Jan 20, 2023
@vovakulikov vovakulikov deleted the vk/add-num-sample-ui-filter branch January 20, 2023 15:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

5 participants