Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete: Add bare bones statistics logging and UI #973

Merged
merged 5 commits into from
Sep 8, 2023

Conversation

philipp-spiess
Copy link
Contributor

I often find myself wanting to know when exactly we count something as suggested vs. when we count it as accepted. Looking at the output tab is not super helpful here either so I added a small UI to the trace view.

This also adds the "infra" to support the trace view to show other views that re-render which I want to use for the section observer shortly.

I’m specifically hoping that this will help with #923.

Test plan

Screen.Recording.2023-09-07.at.15.31.10.mov

@philipp-spiess philipp-spiess requested review from valerybugakov and a team September 7, 2023 13:34
@@ -110,6 +117,9 @@ export function loaded(id: string): void {
// Suggested completions will not be logged immediately. Instead, we log them when we either hide
// them again (they are NOT accepted) or when they ARE accepted. This way, we can calculate the
// duration they were actually visible for.
//
// For statistics logging we start a timeout matching the READ_TIMEOUT so we can increment the
Copy link
Contributor

Choose a reason for hiding this comment

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

Realize this isn't a new name, but it is nice to put the units on quantities ie READ_TIMEOUT_MSEC because it can make it easier to catch some clowntown with dimensions in review.

function statisticSummary(): string {
const { accepted, suggested } = statistics.getStatistics()
return `📈 Suggested: ${suggested} | Accepted: ${accepted} | Acceptance rate: ${
suggested === 0 || accepted === 0 ? 'N/A' : `${((accepted / suggested) * 100).toFixed(2)}%`
Copy link
Contributor

Choose a reason for hiding this comment

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

You could still calculate an acceptance rate with accepted === 0, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha yes of course 🤦

@philipp-spiess philipp-spiess enabled auto-merge (squash) September 8, 2023 13:21
@philipp-spiess philipp-spiess merged commit 5d66ce6 into main Sep 8, 2023
10 checks passed
@philipp-spiess philipp-spiess deleted the ps/ac-statistics branch September 8, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants