diff --git a/api/chalicelib/core/events.py b/api/chalicelib/core/events.py index 3e39ba4bd..81378a49c 100644 --- a/api/chalicelib/core/events.py +++ b/api/chalicelib/core/events.py @@ -341,7 +341,7 @@ class event_type: INPUT = Event(ui_type=schemas.EventType.input, table="events.inputs", column="label") LOCATION = Event(ui_type=schemas.EventType.location, table="events.pages", column="base_path") CUSTOM = Event(ui_type=schemas.EventType.custom, table="events_common.customs", column="name") - REQUEST = Event(ui_type=schemas.EventType.request, table="events_common.requests", column="base_path") + REQUEST = Event(ui_type=schemas.EventType.request, table="events_common.requests", column="path") GRAPHQL = Event(ui_type=schemas.EventType.graphql, table="events.graphql", column="name") STATEACTION = Event(ui_type=schemas.EventType.state_action, table="events.state_actions", column="name") ERROR = Event(ui_type=schemas.EventType.error, table="events.errors", diff --git a/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql index f01ad9001..0b1692b20 100644 --- a/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/helm/db/init_dbs/postgresql/init_schema.sql @@ -100,38 +100,36 @@ $$ LANGUAGE plpgsql; DO $$ BEGIN - IF (with to_check (name) as ( - values ('alerts'), - ('announcements'), - ('assigned_sessions'), - ('autocomplete'), - ('basic_authentication'), - ('dashboards'), - ('dashboard_widgets'), - ('errors'), - ('funnels'), - ('integrations'), - ('issues'), - ('jira_cloud'), - ('jobs'), - ('metric_series'), - ('metrics'), - ('notifications'), - ('oauth_authentication'), - ('projects'), - ('roles'), - ('roles_projects'), - ('searches'), - ('sessions'), - ('tenants'), - ('traces'), - ('user_favorite_errors'), - ('user_favorite_sessions'), - ('user_viewed_errors'), - ('user_viewed_sessions'), - ('users'), - ('webhooks') - ) + IF (with to_check (name) as (values ('alerts'), + ('announcements'), + ('assigned_sessions'), + ('autocomplete'), + ('basic_authentication'), + ('dashboards'), + ('dashboard_widgets'), + ('errors'), + ('funnels'), + ('integrations'), + ('issues'), + ('jira_cloud'), + ('jobs'), + ('metric_series'), + ('metrics'), + ('notifications'), + ('oauth_authentication'), + ('projects'), + ('roles'), + ('roles_projects'), + ('searches'), + ('sessions'), + ('tenants'), + ('traces'), + ('user_favorite_errors'), + ('user_favorite_sessions'), + ('user_viewed_errors'), + ('user_viewed_sessions'), + ('users'), + ('webhooks')) select bool_and(exists(select * from information_schema.tables t where table_schema = 'public' @@ -914,16 +912,14 @@ LANGUAGE plpgsql; DO $$ BEGIN - IF (with to_check (name) as ( - values ('clicks'), - ('errors'), - ('graphql'), - ('inputs'), - ('pages'), - ('performance'), - ('resources'), - ('state_actions') - ) + IF (with to_check (name) as (values ('clicks'), + ('errors'), + ('graphql'), + ('inputs'), + ('pages'), + ('performance'), + ('resources'), + ('state_actions')) select bool_and(exists(select * from information_schema.tables t where table_schema = 'events' @@ -1176,11 +1172,9 @@ LANGUAGE plpgsql; DO $$ BEGIN - IF (with to_check (name) as ( - values ('customs'), - ('issues'), - ('requests') - ) + IF (with to_check (name) as (values ('customs'), + ('issues'), + ('requests')) select bool_and(exists(select * from information_schema.tables t where table_schema = 'events_common' @@ -1238,7 +1232,7 @@ $$ status_code smallint NULL, method http_method NULL, host text NULL, - base_path text NULL, + path text NULL, query text NULL, PRIMARY KEY (session_id, timestamp, seq_index) ); @@ -1263,8 +1257,8 @@ $$ CREATE INDEX IF NOT EXISTS requests_status_code_nn_idx ON events_common.requests (status_code) WHERE status_code IS NOT NULL; CREATE INDEX IF NOT EXISTS requests_host_nn_idx ON events_common.requests (host) WHERE host IS NOT NULL; CREATE INDEX IF NOT EXISTS requests_host_nn_gin_idx ON events_common.requests USING GIN (host gin_trgm_ops) WHERE host IS NOT NULL; - CREATE INDEX IF NOT EXISTS requests_base_path_nn_idx ON events_common.requests (base_path) WHERE base_path IS NOT NULL; - CREATE INDEX IF NOT EXISTS requests_base_path_nn_gin_idx ON events_common.requests USING GIN (base_path gin_trgm_ops) WHERE base_path IS NOT NULL; + CREATE INDEX IF NOT EXISTS requests_path_nn_idx ON events_common.requests (path) WHERE path IS NOT NULL; + CREATE INDEX IF NOT EXISTS requests_path_nn_gin_idx ON events_common.requests USING GIN (path gin_trgm_ops) WHERE path IS NOT NULL; CREATE INDEX IF NOT EXISTS requests_query_nn_idx ON events_common.requests (query) WHERE query IS NOT NULL; CREATE INDEX IF NOT EXISTS requests_query_nn_gin_idx ON events_common.requests USING GIN (query gin_trgm_ops) WHERE query IS NOT NULL; diff --git a/scripts/helm/db/init_dbs/postgresql/1.6.0/1.6.0.sql b/scripts/helm/db/init_dbs/postgresql/1.6.0/1.6.0.sql index dbfdb6d85..1c5e0a06f 100644 --- a/scripts/helm/db/init_dbs/postgresql/1.6.0/1.6.0.sql +++ b/scripts/helm/db/init_dbs/postgresql/1.6.0/1.6.0.sql @@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS dashboard_widgets ALTER TABLE events_common.requests ADD COLUMN IF NOT EXISTS host text NULL, - ADD COLUMN IF NOT EXISTS base_path text NULL, + ADD COLUMN IF NOT EXISTS path text NULL, ADD COLUMN IF NOT EXISTS query text NULL; ALTER TABLE events.pages @@ -312,8 +312,8 @@ ON CONFLICT (predefined_key) DO UPDATE CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_host_nn_idx ON events_common.requests (host) WHERE host IS NOT NULL; CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_host_nn_gin_idx ON events_common.requests USING GIN (host gin_trgm_ops) WHERE host IS NOT NULL; -CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_base_path_nn_idx ON events_common.requests (base_path) WHERE base_path IS NOT NULL; -CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_base_path_nn_gin_idx ON events_common.requests USING GIN (base_path gin_trgm_ops) WHERE base_path IS NOT NULL; +CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_path_nn_idx ON events_common.requests (path) WHERE path IS NOT NULL; +CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_path_nn_gin_idx ON events_common.requests USING GIN (path gin_trgm_ops) WHERE path IS NOT NULL; CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_query_nn_idx ON events_common.requests (query) WHERE query IS NOT NULL; CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_query_nn_gin_idx ON events_common.requests USING GIN (query gin_trgm_ops) WHERE query IS NOT NULL; diff --git a/scripts/helm/db/init_dbs/postgresql/init_schema.sql b/scripts/helm/db/init_dbs/postgresql/init_schema.sql index 5e0323b9c..da2c7bc9c 100644 --- a/scripts/helm/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/helm/db/init_dbs/postgresql/init_schema.sql @@ -646,7 +646,7 @@ $$ status_code smallint NULL, method http_method NULL, host text NULL, - base_path text NULL, + path text NULL, query text NULL, PRIMARY KEY (session_id, timestamp, seq_index) ); @@ -669,8 +669,8 @@ $$ CREATE INDEX requests_status_code_nn_idx ON events_common.requests (status_code) WHERE status_code IS NOT NULL; CREATE INDEX requests_host_nn_idx ON events_common.requests (host) WHERE host IS NOT NULL; CREATE INDEX requests_host_nn_gin_idx ON events_common.requests USING GIN (host gin_trgm_ops) WHERE host IS NOT NULL; - CREATE INDEX requests_base_path_nn_idx ON events_common.requests (base_path) WHERE base_path IS NOT NULL; - CREATE INDEX requests_base_path_nn_gin_idx ON events_common.requests USING GIN (base_path gin_trgm_ops) WHERE base_path IS NOT NULL; + CREATE INDEX requests_path_nn_idx ON events_common.requests (path) WHERE path IS NOT NULL; + CREATE INDEX requests_path_nn_gin_idx ON events_common.requests USING GIN (path gin_trgm_ops) WHERE path IS NOT NULL; CREATE INDEX requests_query_nn_idx ON events_common.requests (query) WHERE query IS NOT NULL; CREATE INDEX requests_query_nn_gin_idx ON events_common.requests USING GIN (query gin_trgm_ops) WHERE query IS NOT NULL;