This repository was archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
internal/event_logs: optimize ping cte #55538
Merged
Merged
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
406baf8
internal/event_logs: optimize ping cte
nathan-downs 383bc92
internal/event_logs: event_logs indexing
nathan-downs 33e60da
internal/event_logs: sg lint
nathan-downs 5ef4c9e
internal/event_logs: sg lint fix
nathan-downs 47965ec
internal/event_logs: bazel configure
nathan-downs 97ce660
Revert "internal/event_logs: bazel configure"
nathan-downs db9040c
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs 09ea293
internal/event_logs: schema definition update
nathan-downs d3e14cc
Merge remote-tracking branch 'origin/nd/fix-ping-query-performance' i…
nathan-downs ad282b7
internal/event_logs: schema definition update
nathan-downs 0ea51e2
internal/event_logs: bazel update
nathan-downs 8538683
internal/event_logs: manual lint fixes
nathan-downs 78c9018
internal/event_logs: manual lint fixes #2
nathan-downs d0bb130
internal/event_logs: revert lint breaking commit
nathan-downs ebd34c4
internal/event_logs: backcompat test drift fix
nathan-downs 98a9bee
internal/event_logs: update name index to lower
nathan-downs c7b5ac1
internal/event_logs: event log indexs
nathan-downs adc6f06
internal/event_logs: remove lower index
nathan-downs 0105f13
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs f5b43f9
Update down.sql
nathan-downs bc8be7b
Update event_logs.go
nathan-downs 631df5b
internal/event_logs: add GIN index
nathan-downs 494a448
internal/event_logs: add GIN index
nathan-downs 3012be9
internal/event_logs: query efficiency changes
nathan-downs 487f44b
internal/event_logs: sql logic and lint fixes
nathan-downs 425a67a
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs 474e301
internal/event_logs: add lookup fuctions
nathan-downs a62bc06
internal/event_logs: refactor cody usage
nathan-downs e0fe148
internal/event_logs: revert deletion
nathan-downs 80dcbfa
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs 89dd5f1
internal/event_logs: lint fixes
nathan-downs 30b4c34
internal/event_logs: lint fixes
nathan-downs db2d622
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs 1d4105a
internal/event_logs: lint fixes
nathan-downs ec866ed
internal/event_logs: lint fixes
nathan-downs a1b64d1
internal/event_logs: lint fixes
nathan-downs 45810ac
internal/event_logs: lint fixes
nathan-downs ae25215
internal/event_logs: typo fixes
nathan-downs 83f7062
internal/event_logs: bazel test fixes
nathan-downs 1e3333a
internal/event_logs: bazel test fixes
nathan-downs 2e94fe7
internal/event_logs: backward compatibility fixes
nathan-downs 0836a0b
internal/event_logs: lint format fix
nathan-downs bd2a187
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs e582b18
internal/event_logs: make functions idempotent
nathan-downs 9bafae6
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs 0be3cb5
internal/event_logs: optimize ping cte
nathan-downs 0f4a5d2
internal/event_logs: event_logs indexing
nathan-downs 1aa5318
internal/event_logs: sg lint
nathan-downs fed4db6
internal/event_logs: sg lint fix
nathan-downs de43253
internal/event_logs: bazel configure
nathan-downs fe2528b
Revert "internal/event_logs: bazel configure"
nathan-downs 708eb7e
internal/event_logs: schema definition update
nathan-downs a1049b4
internal/event_logs: schema definition update
nathan-downs 74dd672
internal/event_logs: bazel update
nathan-downs fb46682
internal/event_logs: manual lint fixes
nathan-downs d16451e
internal/event_logs: manual lint fixes #2
nathan-downs ed8e9a4
internal/event_logs: revert lint breaking commit
nathan-downs 423b1e6
internal/event_logs: backcompat test drift fix
nathan-downs 2c5e61d
internal/event_logs: update name index to lower
nathan-downs 127af73
internal/event_logs: event log indexs
nathan-downs d3c1db2
internal/event_logs: remove lower index
nathan-downs d40d1bf
Update down.sql
nathan-downs 0d52fbb
Update event_logs.go
nathan-downs 2855d83
internal/event_logs: add GIN index
nathan-downs 91b9bea
internal/event_logs: add GIN index
nathan-downs 2e90319
internal/event_logs: query efficiency changes
nathan-downs e197a41
internal/event_logs: sql logic and lint fixes
nathan-downs 9fb60be
internal/event_logs: add lookup fuctions
nathan-downs e6990fb
internal/event_logs: refactor cody usage
nathan-downs 034f844
internal/event_logs: revert deletion
nathan-downs a70cab5
internal/event_logs: lint fixes
nathan-downs 59d0788
internal/event_logs: lint fixes
nathan-downs 370f2a8
internal/event_logs: lint fixes
nathan-downs da85d83
internal/event_logs: lint fixes
nathan-downs 8a02a4b
internal/event_logs: lint fixes
nathan-downs c982b5c
internal/event_logs: lint fixes
nathan-downs 6dd80b2
internal/event_logs: typo fixes
nathan-downs 1ec016e
internal/event_logs: bazel test fixes
nathan-downs ee134b0
internal/event_logs: bazel test fixes
nathan-downs a2328b5
internal/event_logs: backward compatibility fixes
nathan-downs 210c0a1
internal/event_logs: lint format fix
nathan-downs f99d211
internal/event_logs: make functions idempotent
nathan-downs 893afde
internal/event_logs: remove gin index
nathan-downs 3005d9e
WIP commit
nathan-downs dc940c3
internal/event_logs: update event_logs_test
nathan-downs 50bba65
internal/event_logs: remove gin index
nathan-downs e924cc0
Merge branch 'main' into nd/fix-ping-query-performance
nathan-downs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
migrations/frontend/1691043630_event_logs_indexing/down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DROP INDEX IF EXISTS event_logs_name_is_cody_explanation_event; | ||
|
||
DROP INDEX IF EXISTS event_logs_name_is_cody_generation_event; | ||
|
||
DROP INDEX IF EXISTS event_logs_name_is_cody_active_event; | ||
|
||
DROP FUNCTION IF EXISTS isCodyGenerationEvent(name text); | ||
|
||
DROP FUNCTION IF EXISTS isCodyExplanationEvent(name text); | ||
|
||
DROP FUNCTION IF EXISTS isCodyActiveEvent(name text); |
2 changes: 2 additions & 0 deletions
2
migrations/frontend/1691043630_event_logs_indexing/metadata.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name: event_logs_indexing | ||
parents: [1690460411, 1690323910] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
CREATE OR REPLACE FUNCTION iscodyactiveevent(name text) RETURNS boolean | ||
LANGUAGE plpgsql IMMUTABLE | ||
AS $$ | ||
BEGIN | ||
RETURN | ||
(name LIKE '%%cody%%' OR name LIKE '%%Cody%%') | ||
AND name NOT IN ( | ||
'%completion:started%', | ||
'%completion:suggested%', | ||
'%cta%', | ||
'%Cta%', | ||
'CodyVSCodeExtension:CodySavedLogin:executed', | ||
'web:codyChat:tryOnPublicCode', | ||
'web:codyEditorWidget:viewed', | ||
'web:codyChat:pageViewed', | ||
'CodyConfigurationPageViewed', | ||
'ClickedOnTryCodySearchCTA', | ||
'TryCodyWebOnboardingDisplayed', | ||
'AboutGetCodyPopover', | ||
'TryCodyWeb', | ||
'CodySurveyToastViewed', | ||
'SiteAdminCodyPageViewed', | ||
'CodyUninstalled', | ||
'SpeakToACodyEngineerCTA' | ||
); | ||
END; | ||
$$; | ||
|
||
CREATE OR REPLACE FUNCTION iscodyexplanationevent(name text) RETURNS boolean | ||
LANGUAGE plpgsql IMMUTABLE | ||
AS $$ | ||
BEGIN | ||
RETURN name = ANY(ARRAY[ | ||
'CodyVSCodeExtension:recipe:explain-code-high-level:executed', | ||
'CodyVSCodeExtension:recipe:explain-code-detailed:executed', | ||
'CodyVSCodeExtension:recipe:find-code-smells:executed', | ||
'CodyVSCodeExtension:recipe:git-history:executed', | ||
'CodyVSCodeExtension:recipe:rate-code:executed' | ||
]); | ||
END; | ||
$$; | ||
|
||
CREATE OR REPLACE FUNCTION iscodygenerationevent(name text) RETURNS boolean | ||
LANGUAGE plpgsql IMMUTABLE | ||
AS $$ | ||
BEGIN | ||
RETURN name = ANY(ARRAY[ | ||
'CodyVSCodeExtension:recipe:rewrite-to-functional:executed', | ||
'CodyVSCodeExtension:recipe:improve-variable-names:executed', | ||
'CodyVSCodeExtension:recipe:replace:executed', | ||
'CodyVSCodeExtension:recipe:generate-docstring:executed', | ||
'CodyVSCodeExtension:recipe:generate-unit-test:executed', | ||
'CodyVSCodeExtension:recipe:rewrite-functional:executed', | ||
'CodyVSCodeExtension:recipe:code-refactor:executed', | ||
'CodyVSCodeExtension:recipe:fixup:executed', | ||
'CodyVSCodeExtension:recipe:translate-to-language:executed' | ||
]); | ||
END; | ||
$$; | ||
|
||
CREATE INDEX IF NOT EXISTS event_logs_name_is_cody_explanation_event ON event_logs USING btree (iscodyexplanationevent(name)); | ||
|
||
CREATE INDEX IF NOT EXISTS event_logs_name_is_cody_generation_event ON event_logs USING btree (iscodygenerationevent(name)); | ||
|
||
CREATE INDEX IF NOT EXISTS event_logs_name_is_cody_active_event ON event_logs USING btree (iscodyactiveevent(name)); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How static are these lists? will they need to be updated frequently? Because every time we update, it will require a migration and a re-index, which will be pretty expensive for the event logs table.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends, we may have to modify these to add logic for categorizing events that don't follow the specific active usage patterns. More than likely the isactivecodyevent(text)