openreplay/ee/connectors/sql/redshift_sessions.sql
MauricioGarciaS 28182b951e
Redshift connector (#1170)
* Updated dependancies for redshift connector, changed os module for python-decouple module

* Updated service and images

* Updated message protocol, added exception for BatchMetadata when version is 0 (we apply old read method)

* fixed load error from s3 to redshift. null values for string columns are now empty strings ("")

* Added file test consumer_async.py: reads every 3 minutes kafka raw and send task in background to upload to cloud

* Added method to skip messages that are not inserted to cloud

* Added logs into consumer_async. Changed urls and issues in sessions table from list to string

* Split between messages for sessions table and for events table

* Updated redshift tables

* Fixed small issue in query redshift_sessions.sql

* Updated Dockerfiles. Cleaned logs of consumer_async. Updated/Fixed tables. Transformed Nan as NULL for VARCHAR columns

* Added error handler for sql dropped connection

* chore(docker): Optimize docker builds

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>

* Variables renamed

* Adding compression libraries

* Set default value of count events to 0 (instead of NULL) when event did not occur

* Added support specific  project tracking. Added PG handler to connect to sessions table

* Added method to update values in db connection for sessions ended and restarted

* Removing intelligent file copying

* chore(connector): Build file

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>

* Adding connection pool for pg

* Renaming and optimizing

* Fixed issue of missing information of sessions

---------

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
Co-authored-by: rjshrjndrn <rjshrjndrn@gmail.com>
2023-05-02 14:02:57 +02:00

45 lines
1.8 KiB
SQL

CREATE TABLE IF NOT EXISTS connector_user_sessions
(
-- SESSION METADATA
sessionid bigint,
user_agent VARCHAR,
user_browser VARCHAR,
user_browser_version VARCHAR,
user_country VARCHAR,
user_device VARCHAR,
user_device_heap_size bigint,
user_device_memory_size bigint,
user_device_type VARCHAR,
user_os VARCHAR,
user_os_version VARCHAR,
user_uuid VARCHAR,
connection_effective_bandwidth bigint, -- Downlink
connection_type VARCHAR, --"bluetooth", "cellular", "ethernet", "none", "wifi", "wimax", "other", "unknown"
metadata_key VARCHAR,
metadata_value VARCHAR,
referrer VARCHAR,
user_anonymous_id VARCHAR,
user_id VARCHAR,
-- TIME
session_start_timestamp bigint,
session_end_timestamp bigint,
session_duration bigint,
-- SPEED INDEX RELATED
first_contentful_paint bigint,
speed_index bigint,
visually_complete bigint,
timing_time_to_interactive bigint,
-- PERFORMANCE
avg_cpu bigint,
avg_fps bigint,
max_cpu bigint,
max_fps bigint,
max_total_js_heap_size bigint,
max_used_js_heap_size bigint,
-- ISSUES AND EVENTS
js_exceptions_count bigint,
inputs_count bigint,
clicks_count bigint,
issues_count bigint,
urls_count bigint
);