From 70bae502d35899672e25a74885f2915f03968473 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Fri, 27 Dec 2024 14:11:39 +0100 Subject: [PATCH 1/3] Dev (#2914) * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(chalice): fixed get recording status --- api/chalicelib/core/sessions/sessions_ch.py | 29 ++------------------- api/routers/core.py | 4 +-- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/api/chalicelib/core/sessions/sessions_ch.py b/api/chalicelib/core/sessions/sessions_ch.py index 298d7e11e..0dd9d4d1e 100644 --- a/api/chalicelib/core/sessions/sessions_ch.py +++ b/api/chalicelib/core/sessions/sessions_ch.py @@ -11,6 +11,7 @@ from chalicelib.utils import sql_helper as sh logger = logging.getLogger(__name__) + def search2_series(data: schemas.SessionsSearchPayloadSchema, project_id: int, density: int, metric_type: schemas.MetricType, metric_of: schemas.MetricOfTimeseries | schemas.MetricOfTable, metric_value: List): @@ -1307,7 +1308,6 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu return full_args, query_part - def get_user_sessions(project_id, user_id, start_date, end_date): with pg_client.PostgresClient() as cur: constraints = ["s.project_id = %(projectId)s", "s.user_id = %(userId)s"] @@ -1385,29 +1385,4 @@ def session_exists(project_id, session_id): # TODO: support this for CH def check_recording_status(project_id: int) -> dict: - query = f""" - WITH project_sessions AS (SELECT COUNT(1) AS full_count, - COUNT(1) FILTER ( WHERE duration IS NOT NULL) AS nn_duration_count - FROM public.sessions - WHERE project_id = %(project_id)s - AND start_ts >= (extract(EPOCH FROM now() - INTERVAL '1 day')) * 1000 - AND start_ts <= (extract(EPOCH FROM now() + INTERVAL '1 day')) * 1000) - SELECT CASE - WHEN full_count = 0 THEN 0 - WHEN nn_duration_count = 0 THEN 1 - ELSE 2 - END AS recording_status, - full_count AS sessions_count - FROM project_sessions; - """ - - with pg_client.PostgresClient() as cur: - query = cur.mogrify(query, {"project_id": project_id}) - cur.execute(query) - row = cur.fetchone() - - return { - "recordingStatus": row["recording_status"], - "sessionsCount": row["sessions_count"] - } - + return sessions_legacy.check_recording_status(project_id=project_id) diff --git a/api/routers/core.py b/api/routers/core.py index 7a6f60f3f..9bfddef5d 100644 --- a/api/routers/core.py +++ b/api/routers/core.py @@ -4,7 +4,7 @@ from decouple import config from fastapi import Depends, Body, BackgroundTasks import schemas -from chalicelib.core import sourcemaps, events, projects, issues, metadata, reset_password, log_tools, sessions, \ +from chalicelib.core import sourcemaps, events, projects, issues, metadata, reset_password, log_tools, \ announcements, weekly_report, assist, mobile, tenants, boarding, notifications, webhook, users, saved_search, tags from chalicelib.core.metrics import custom_metrics from chalicelib.core.alerts import alerts @@ -13,7 +13,7 @@ from chalicelib.core.issue_tracking import github, integrations_global, integrat jira_cloud from chalicelib.core.log_tools import datadog, newrelic, stackdriver, elasticsearch, \ sentry, bugsnag, cloudwatch, sumologic, rollbar -from chalicelib.core.sessions import sessions_assignments +from chalicelib.core.sessions import sessions_assignments, sessions from chalicelib.core.collaborations.collaboration_msteams import MSTeams from chalicelib.core.collaborations.collaboration_slack import Slack from or_dependencies import OR_context, OR_role From 297f63390697a8053bb2c136fd30590f102fd5c4 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 27 Dec 2024 14:48:27 +0100 Subject: [PATCH 2/3] fix(tracker): data type --- tracker/tracker-reactnative/android/build.gradle | 12 +----------- .../com/openreplay/reactnative/ReactNativeModule.kt | 13 +++++++++++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tracker/tracker-reactnative/android/build.gradle b/tracker/tracker-reactnative/android/build.gradle index b188ae009..37b362021 100644 --- a/tracker/tracker-reactnative/android/build.gradle +++ b/tracker/tracker-reactnative/android/build.gradle @@ -58,7 +58,6 @@ android { defaultConfig { minSdkVersion getExtOrIntegerDefault("minSdkVersion") targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") - } buildTypes { @@ -91,16 +90,7 @@ dependencies { //noinspection GradleDynamicVersion implementation("com.facebook.react:react-native:0.20.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") - implementation("com.github.openreplay:android-tracker:v1.1.4") + implementation("com.github.openreplay:android-tracker:v1.1.5") } -//allprojects { -// repositories { -// maven { url = uri("https://jitpack.io") } -// google() -// mavenCentral() -// } -//} - - diff --git a/tracker/tracker-reactnative/android/src/main/java/com/openreplay/reactnative/ReactNativeModule.kt b/tracker/tracker-reactnative/android/src/main/java/com/openreplay/reactnative/ReactNativeModule.kt index 10037a91f..8919b93a0 100644 --- a/tracker/tracker-reactnative/android/src/main/java/com/openreplay/reactnative/ReactNativeModule.kt +++ b/tracker/tracker-reactnative/android/src/main/java/com/openreplay/reactnative/ReactNativeModule.kt @@ -104,7 +104,16 @@ class ReactNativeModule(reactContext: ReactApplicationContext) : status: Int, duration: Double ) { - val durationULong = duration.toLong().toULong() - OpenReplay.networkRequest(url, method, requestJSON, responseJSON, status, durationULong) + // val durationLong: Long = duration.toLong() + val durationULong: ULong = duration.toLong().toULong() + + OpenReplay.networkRequest( + url = url, + method = method, + requestJSON = requestJSON, + responseJSON = responseJSON, + status = status, + duration = durationULong + ) } } From e8dbc40a5cefb32c80eb19bc1ce23f7d9796bc2f Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 30 Dec 2024 12:46:39 +0100 Subject: [PATCH 3/3] change(react-native): android version jump to use v1.1.6 --- tracker/tracker-reactnative/android/build.gradle | 2 +- tracker/tracker-reactnative/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker/tracker-reactnative/android/build.gradle b/tracker/tracker-reactnative/android/build.gradle index 37b362021..1101c3467 100644 --- a/tracker/tracker-reactnative/android/build.gradle +++ b/tracker/tracker-reactnative/android/build.gradle @@ -90,7 +90,7 @@ dependencies { //noinspection GradleDynamicVersion implementation("com.facebook.react:react-native:0.20.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") - implementation("com.github.openreplay:android-tracker:v1.1.5") + implementation("com.github.openreplay:android-tracker:v1.1.6") } diff --git a/tracker/tracker-reactnative/package.json b/tracker/tracker-reactnative/package.json index b177b0070..2022cae52 100644 --- a/tracker/tracker-reactnative/package.json +++ b/tracker/tracker-reactnative/package.json @@ -1,6 +1,6 @@ { "name": "@openreplay/react-native", - "version": "0.6.11", + "version": "0.6.13", "description": "Openreplay React-native connector for iOS applications", "main": "lib/commonjs/index", "module": "lib/module/index",