From c6f55110f5107851422bb59637096a01d013d539 Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Wed, 21 Sep 2022 06:45:28 +0200 Subject: [PATCH 01/23] chore(minio): set lifecycle only for mobs bucket Signed-off-by: rjshrjndrn --- scripts/helmcharts/openreplay/files/minio.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helmcharts/openreplay/files/minio.sh b/scripts/helmcharts/openreplay/files/minio.sh index 28d04a28f..31502ae39 100644 --- a/scripts/helmcharts/openreplay/files/minio.sh +++ b/scripts/helmcharts/openreplay/files/minio.sh @@ -28,8 +28,8 @@ EOF for bucket in ${buckets[*]}; do mc mb minio/${bucket} || true -mc ilm import minio/${bucket} < /tmp/lifecycle.json || true done +mc ilm import minio/mobs < /tmp/lifecycle.json || true # Creating frontend bucket mc mb minio/frontend || true From 967db9b9ded4e6cba05c7f8650d58649e0beec38 Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Wed, 21 Sep 2022 10:13:10 +0200 Subject: [PATCH 02/23] chore(helm): Adding assist key in chalice Signed-off-by: rjshrjndrn --- .../openreplay/charts/chalice/templates/deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index 6c9f2beaf..7474a7eed 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -42,6 +42,8 @@ spec: {{- .Values.healthCheck | toYaml | nindent 10}} {{- end}} env: + - name: ASSIST_KEY + value: {{ .Values.global.assistKey }} - name: LICENSE_KEY value: '{{ .Values.global.enterpriseEditionLicense }}' - name: version_number From 5e21a4c6d06e70a7f074280c8dad21e34c17dd8f Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Wed, 21 Sep 2022 10:48:29 +0200 Subject: [PATCH 03/23] fix(helm): typo Signed-off-by: rjshrjndrn --- .../openreplay/charts/peers/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml index 361aee0e0..7c08dd718 100644 --- a/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml @@ -44,7 +44,7 @@ spec: env: - name: ASSIST_KEY value: {{ .Values.global.assistKey }} - - name: S3_KEYASSIST_KEY + - name: S3_KEY value: {{ .Values.global.s3.accessKey }} {{- range $key, $val := .Values.env }} - name: {{ $key }} From efea82c783055257afbc11a053ce6adc53d34266 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Wed, 21 Sep 2022 10:13:21 +0100 Subject: [PATCH 04/23] feat(peers): fixed assertion --- peers/server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/peers/server.js b/peers/server.js index 0eb99a9de..c4416b58a 100644 --- a/peers/server.js +++ b/peers/server.js @@ -1,5 +1,6 @@ const dumps = require('./utils/HeapSnapshot'); const {request_logger} = require('./utils/helper'); +const assert = require('assert').strict; const {peerRouter, peerConnection, peerDisconnect, peerError} = require('./servers/peerjs-server'); const express = require('express'); const {ExpressPeerServer} = require('peer'); From bd9009a7f5a13a7953eff1403d24d43fa1ab3a8a Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 23 Sep 2022 14:36:52 +0200 Subject: [PATCH 05/23] change(tracker): 4.0.2 --- tracker/tracker-assist/package.json | 2 +- tracker/tracker/package.json | 2 +- tracker/tracker/src/main/app/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tracker/tracker-assist/package.json b/tracker/tracker-assist/package.json index 271dda78a..5591c0731 100644 --- a/tracker/tracker-assist/package.json +++ b/tracker/tracker-assist/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker-assist", "description": "Tracker plugin for screen assistance through the WebRTC", - "version": "4.0.1", + "version": "4.0.2", "keywords": [ "WebRTC", "assistance", diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index 5699bcdf9..3d30d9917 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "4.0.1", + "version": "4.0.2", "keywords": [ "logging", "replay" diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index e96f8d64d..769cc8672 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -309,7 +309,7 @@ export default class App { } getHost(): string { - return new URL(this.options.ingestPoint).hostname + return new URL(this.options.ingestPoint).host } getProjectKey(): string { return this.projectKey From 418d235dbb71ce3d1f53a4a6ac7ba43b3a5e22fe Mon Sep 17 00:00:00 2001 From: Mehdi Osman Date: Mon, 7 Nov 2022 18:17:47 +0100 Subject: [PATCH 06/23] Removed contributors section --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 6a644c0bc..363c64d1c 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,3 @@ Check out our [roadmap](https://www.notion.so/openreplay/Roadmap-889d2c3d968b478 ## License This monorepo uses several licenses. See [LICENSE](/LICENSE) for more details. - -## Contributors - - - - From 03ce36f4b15ba0079a41fab999d7b2fb8559b229 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Mon, 14 Nov 2022 11:14:29 +0000 Subject: [PATCH 07/23] ci(actions): skip security checks (#810) Signed-off-by: rjshrjndrn --- .github/workflows/workers.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/workers.yaml b/.github/workflows/workers.yaml index 2f215470b..1b8c7f495 100644 --- a/.github/workflows/workers.yaml +++ b/.github/workflows/workers.yaml @@ -7,6 +7,10 @@ on: description: 'Name of a single service to build(in small letters). "all" to build everything' required: false default: 'false' + skip_security_checks: + description: 'Skip Security checks if there is a unfixable vuln or error. Value: true/false' + required: false + default: 'false' push: branches: - dev @@ -61,6 +65,7 @@ jobs: # set -x touch /tmp/images_to_build.txt + skip_security_checks=${{ github.event.inputs.skip_security_checks }} tmp_param=${{ github.event.inputs.build_service }} build_param=${tmp_param:-'false'} case ${build_param} in From a57fc700195ea35d096008fbcc0dfd4851050bb5 Mon Sep 17 00:00:00 2001 From: Malik Ahmed Date: Tue, 22 Nov 2022 13:40:48 -0500 Subject: [PATCH 08/23] Fix logs (verbose) CLI option (#808) --- sourcemap-uploader/cli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sourcemap-uploader/cli.js b/sourcemap-uploader/cli.js index 7085f1345..28c167ea3 100755 --- a/sourcemap-uploader/cli.js +++ b/sourcemap-uploader/cli.js @@ -55,10 +55,10 @@ dir.addArgument(['-u', '--js-dir-url'], { // TODO: exclude in dir -const { command, api_key, project_key, server, verbose, ...args } = +const { command, api_key, project_key, server, logs, ...args } = parser.parseArgs(); -global._VERBOSE = !!verbose; +global._VERBOSE = !!logs; (command === 'file' ? uploadFile( From 4698075aa0ffe51b4b8caf221bc2e4e4b4c8b6dc Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Fri, 25 Nov 2022 10:27:12 +0000 Subject: [PATCH 09/23] Make helm installation namespaces customizable (#836) * chore(helm): Better configurability. Signed-off-by: rjshrjndrn * chore(init): Adding sleep 10 for resources to be up Signed-off-by: rjshrjndrn * fix(helm): Updated env vars Signed-off-by: rjshrjndrn * chore(helm): Derive namespace from minio endpoint Signed-off-by: rjshrjndrn * feat(helm): Update namespace for chalice env vars Signed-off-by: rjshrjndrn * chore(init): random secret for assist jwt secret Signed-off-by: rjshrjndrn * chore(backend): Removing unnecessary files Signed-off-by: rjshrjndrn Signed-off-by: rjshrjndrn --- backend/cmd/db/values.yaml | 92 ------------------- scripts/helmcharts/databases/values.yaml | 1 + scripts/helmcharts/init.sh | 3 + .../charts/alerts/templates/deployment.yaml | 6 +- .../openreplay/charts/alerts/values.yaml | 2 - .../charts/assets/templates/deployment.yaml | 2 +- .../charts/assist/templates/deployment.yaml | 4 +- .../openreplay/charts/assist/values.yaml | 1 - .../charts/chalice/templates/deployment.yaml | 10 +- .../openreplay/charts/chalice/values.yaml | 2 - .../charts/db/templates/deployment.yaml | 2 + .../openreplay/charts/db/values.yaml | 2 +- .../charts/frontend/templates/deployment.yaml | 2 +- .../charts/http/templates/deployment.yaml | 2 +- .../charts/http/templates/ingress.yaml | 4 +- .../charts/quickwit/templates/deployment.yaml | 3 +- .../charts/quickwit/templates/init.yaml | 4 +- .../openreplay/charts/quickwit/values.yaml | 1 - .../charts/sink/templates/deployment.yaml | 2 +- .../sourcemapreader/templates/deployment.yaml | 4 +- .../utilities/templates/report-cron.yaml | 2 +- .../templates/sessions-cleaner-cron.yaml | 2 +- .../utilities/templates/telemetry-cron.yaml | 2 +- .../openreplay/charts/utilities/values.yaml | 1 - .../helmcharts/openreplay/files/clickhouse.sh | 4 +- scripts/helmcharts/openreplay/files/minio.sh | 3 +- scripts/helmcharts/openreplay/files/vault.sh | 2 +- .../helmcharts/openreplay/templates/job.yaml | 12 ++- scripts/helmcharts/openreplay/values.yaml | 23 +++++ scripts/helmcharts/vars.yaml | 26 ++---- 30 files changed, 82 insertions(+), 144 deletions(-) delete mode 100644 backend/cmd/db/values.yaml diff --git a/backend/cmd/db/values.yaml b/backend/cmd/db/values.yaml deleted file mode 100644 index 2c0f0e7f3..000000000 --- a/backend/cmd/db/values.yaml +++ /dev/null @@ -1,92 +0,0 @@ -chalice: - env: - jwt_secret: SetARandomStringHere -clickhouse: - enabled: false -fromVersion: v1.6.0 -global: - domainName: openreplay.local - email: - emailFrom: OpenReplay - emailHost: "" - emailPassword: "" - emailPort: "587" - emailSslCert: "" - emailSslKey: "" - emailUseSsl: "false" - emailUseTls: "true" - emailUser: "" - enterpriseEditionLicense: "" - ingress: - controller: - config: - enable-real-ip: true - force-ssl-redirect: false - max-worker-connections: 0 - proxy-body-size: 10m - ssl-redirect: false - extraArgs: - default-ssl-certificate: app/openreplay-ssl - ingressClass: openreplay - ingressClassResource: - name: openreplay - service: - externalTrafficPolicy: Local - kafka: - kafkaHost: kafka.db.svc.cluster.local - kafkaPort: "9092" - kafkaUseSsl: "false" - zookeeperHost: databases-zookeeper.svc.cluster.local - zookeeperNonTLSPort: 2181 - postgresql: - postgresqlDatabase: postgres - postgresqlHost: postgresql.db.svc.cluster.local - postgresqlPassword: changeMePassword - postgresqlPort: "5432" - postgresqlUser: postgres - redis: - redisHost: redis-master.db.svc.cluster.local - redisPort: "6379" - s3: - accessKey: changeMeMinioAccessKey - assetsBucket: sessions-assets - endpoint: http://minio.db.svc.cluster.local:9000 - recordingsBucket: mobs - region: us-east-1 - secretKey: changeMeMinioPassword - sourcemapsBucket: sourcemaps -ingress-nginx: - controller: - config: - enable-real-ip: true - force-ssl-redirect: false - max-worker-connections: 0 - proxy-body-size: 10m - ssl-redirect: false - extraArgs: - default-ssl-certificate: app/openreplay-ssl - ingressClass: openreplay - ingressClassResource: - name: openreplay - service: - externalTrafficPolicy: Local -kafka: - kafkaHost: kafka.db.svc.cluster.local - kafkaPort: "9092" - kafkaUseSsl: "false" - zookeeperHost: databases-zookeeper.svc.cluster.local - zookeeperNonTLSPort: 2181 -minio: - global: - minio: - accessKey: changeMeMinioAccessKey - secretKey: changeMeMinioPassword -postgresql: - postgresqlDatabase: postgres - postgresqlHost: postgresql.db.svc.cluster.local - postgresqlPassword: changeMePassword - postgresqlPort: "5432" - postgresqlUser: postgres -redis: - redisHost: redis-master.db.svc.cluster.local - redisPort: "6379" diff --git a/scripts/helmcharts/databases/values.yaml b/scripts/helmcharts/databases/values.yaml index 0bd1ad02d..bd2731942 100644 --- a/scripts/helmcharts/databases/values.yaml +++ b/scripts/helmcharts/databases/values.yaml @@ -143,5 +143,6 @@ clickhouse: postgreql: enabled: true +# For enterpriseEdition Only vault: enabled: false diff --git a/scripts/helmcharts/init.sh b/scripts/helmcharts/init.sh index fe088fc51..ebbfd60c3 100644 --- a/scripts/helmcharts/init.sh +++ b/scripts/helmcharts/init.sh @@ -67,6 +67,8 @@ usr=`whoami` fi } +sleep 10 + # ## Installing openssl # sudo apt update &> /dev/null # sudo apt install openssl -y &> /dev/null @@ -106,6 +108,7 @@ sed_i_wrapper -i "s/accessKey: \"changeMeMinioAccessKey\"/accessKey: \"$(randomP sed_i_wrapper -i "s/secretKey: \"changeMeMinioPassword\"/secretKey: \"$(randomPass)\"/g" vars.yaml sed_i_wrapper -i "s/jwt_secret: \"SetARandomStringHere\"/jwt_secret: \"$(randomPass)\"/g" vars.yaml sed_i_wrapper -i "s/assistKey: \"SetARandomStringHere\"/assistKey: \"$(randomPass)\"/g" vars.yaml +sed_i_wrapper -i "s/assistJWTSecret: \"SetARandomStringHere\"/assistJWTSecret: \"$(randomPass)\"/g" vars.yaml sed_i_wrapper -i "s/domainName: \"\"/domainName: \"${DOMAIN_NAME}\"/g" vars.yaml info "Setting proper permission for shared folder" diff --git a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml index 57ee8af1b..24d40bf21 100644 --- a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml @@ -51,6 +51,10 @@ spec: value: "5432" - name: pg_dbname value: "{{ .Values.global.postgresql.postgresqlDatabase }}" + - name: ch_host + value: "{{ .Values.global.clickhouse.chHost }}" + - name: ch_port + value: "{{ .Values.global.clickhouse.service.webPort }}" - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password @@ -58,7 +62,7 @@ spec: - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' diff --git a/scripts/helmcharts/openreplay/charts/alerts/values.yaml b/scripts/helmcharts/openreplay/charts/alerts/values.yaml index a27fc9117..a54418a9f 100644 --- a/scripts/helmcharts/openreplay/charts/alerts/values.yaml +++ b/scripts/helmcharts/openreplay/charts/alerts/values.yaml @@ -98,8 +98,6 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 env: - ch_host: clickhouse-openreplay-clickhouse.db.svc.cluster.local - ch_port: 9000 PYTHONUNBUFFERED: '0' diff --git a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml index 3a60c45f1..47a79be24 100644 --- a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml @@ -69,7 +69,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} # Local minio Installation value: 'https://{{ .Values.global.domainName }}:{{.Values.global.ingress.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' {{- else if contains "amazonaws.com" .Values.global.s3.endpoint }} diff --git a/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml index a0fe1563e..eb6ada0da 100644 --- a/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml @@ -50,7 +50,7 @@ spec: - name: AWS_DEFAULT_REGION value: "{{ .Values.global.s3.region }}" - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' @@ -59,6 +59,8 @@ spec: value: {{ .Values.global.s3.accessKey }} - name: S3_SECRET value: {{ .Values.global.s3.secretKey }} + - name: REDIS_URL + value: {{ .Values.global.redis.redisHost }} {{- range $key, $val := .Values.env }} - name: {{ $key }} value: '{{ $val }}' diff --git a/scripts/helmcharts/openreplay/charts/assist/values.yaml b/scripts/helmcharts/openreplay/charts/assist/values.yaml index 056854751..8ff07d2d0 100644 --- a/scripts/helmcharts/openreplay/charts/assist/values.yaml +++ b/scripts/helmcharts/openreplay/charts/assist/values.yaml @@ -94,7 +94,6 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 env: - REDIS_URL: "redis://redis-master.db.svc.cluster.local:6379" debug: 0 uws: false redis: false diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index 6dd840d57..f4c04f4ad 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -43,6 +43,14 @@ spec: {{- .Values.healthCheck | toYaml | nindent 10}} {{- end}} env: + - name: ch_host + value: "{{ .Values.global.clickhouse.chHost }}" + - name: ch_port + value: "{{ .Values.global.clickhouse.service.webPort }}" + - name: sourcemaps_reader + value: "http://sourcemaps-reader-openreplay.{{.Release.Namespace}}.{{.Values.global.clusterDomain}}:9000/sourcemaps/%s/sourcemaps" + - name: ASSIST_URL + value: "http://assist-openreplay.{{.Release.Namespace}}.{{.Values.global.clusterDomain}}:9001/assist/%s" - name: ASSIST_JWT_SECRET value: {{ .Values.global.assistJWTSecret }} - name: ASSIST_KEY @@ -64,7 +72,7 @@ spec: - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' diff --git a/scripts/helmcharts/openreplay/charts/chalice/values.yaml b/scripts/helmcharts/openreplay/charts/chalice/values.yaml index 05802a9a6..801dd26f7 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/values.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/values.yaml @@ -91,8 +91,6 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 env: - ch_host: clickhouse-openreplay-clickhouse.db.svc.cluster.local - ch_port: 9000 captcha_server: '' captcha_key: '' async_Token: '' diff --git a/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml index 21b9c5c6e..3ffd981a9 100644 --- a/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml @@ -43,6 +43,8 @@ spec: {{- .Values.healthCheck | toYaml | nindent 10}} {{- end}} env: + - name: CLICKHOUSE_STRING + value: '{{ .Values.global.clickhouse.chHost }}:{{.Values.global.clickhouse.service.webPort}}/{{.Values.env.ch_db}}' - name: LICENSE_KEY value: '{{ .Values.global.enterpriseEditionLicense }}' - name: REDIS_STRING diff --git a/scripts/helmcharts/openreplay/charts/db/values.yaml b/scripts/helmcharts/openreplay/charts/db/values.yaml index d03e000ef..fe34eecc9 100644 --- a/scripts/helmcharts/openreplay/charts/db/values.yaml +++ b/scripts/helmcharts/openreplay/charts/db/values.yaml @@ -98,7 +98,7 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 env: - CLICKHOUSE_STRING: tcp://clickhouse-openreplay-clickhouse.db.svc.cluster.local:9000/default + ch_db: default nodeSelector: {} diff --git a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml index 90501f5c7..92d1b7002 100644 --- a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml @@ -67,7 +67,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - {{- if eq .Values.global.s3.endpoint "frontend://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} # Local minio Installation value: 'frontends://{{ .Values.global.domainName }}:{{.Values.global.ingress.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' {{- else if contains "amazonaws.com" .Values.global.s3.endpoint }} diff --git a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml index 4475e0d0d..d0f18cba6 100644 --- a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml @@ -67,7 +67,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} # Local minio Installation value: 'https://{{ .Values.global.domainName }}:{{.Values.global.ingress.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' {{- else if contains "amazonaws.com" .Values.global.s3.endpoint }} diff --git a/scripts/helmcharts/openreplay/charts/http/templates/ingress.yaml b/scripts/helmcharts/openreplay/charts/http/templates/ingress.yaml index 2097fb1cd..5188285a3 100644 --- a/scripts/helmcharts/openreplay/charts/http/templates/ingress.yaml +++ b/scripts/helmcharts/openreplay/charts/http/templates/ingress.yaml @@ -36,7 +36,7 @@ spec: path: /ingest/(.*) {{- end }} -{{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} +{{- if contains "minio" .Values.global.s3.endpoint }} ## TODO: ## Frontend service from minio will be migrated to nginx atomic container. ## This ingress is just a workaround. @@ -45,7 +45,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: minio - namespace: db + namespace: "{{(split "." .Values.global.s3.endpoint)._1}}" spec: ingressClassName: "{{ tpl .Values.ingress.className . }}" rules: diff --git a/scripts/helmcharts/openreplay/charts/quickwit/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/quickwit/templates/deployment.yaml index 539dd78b2..3ac58c215 100644 --- a/scripts/helmcharts/openreplay/charts/quickwit/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/quickwit/templates/deployment.yaml @@ -48,9 +48,8 @@ spec: env: - name: AWS_DEFAULT_REGION value: "{{ .Values.global.s3.region }}" - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} - name: QW_S3_ENDPOINT - value: 'http://minio.db.svc.cluster.local:9000' + value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: AWS_ACCESS_KEY_ID value: {{ .Values.global.s3.accessKey }} diff --git a/scripts/helmcharts/openreplay/charts/quickwit/templates/init.yaml b/scripts/helmcharts/openreplay/charts/quickwit/templates/init.yaml index 6739de1af..b9d102765 100644 --- a/scripts/helmcharts/openreplay/charts/quickwit/templates/init.yaml +++ b/scripts/helmcharts/openreplay/charts/quickwit/templates/init.yaml @@ -19,10 +19,8 @@ spec: env: - name: AWS_DEFAULT_REGION value: "{{ .Values.global.s3.region }}" - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} - name: QW_S3_ENDPOINT - value: 'http://minio.db.svc.cluster.local:9000' - {{- end}} + value: '{{.Values.global.s3.endpoint}}' - name: AWS_ACCESS_KEY_ID value: {{ .Values.global.s3.accessKey }} - name: AWS_SECRET_ACCESS_KEY diff --git a/scripts/helmcharts/openreplay/charts/quickwit/values.yaml b/scripts/helmcharts/openreplay/charts/quickwit/values.yaml index 0e91a4a58..561af61ce 100644 --- a/scripts/helmcharts/openreplay/charts/quickwit/values.yaml +++ b/scripts/helmcharts/openreplay/charts/quickwit/values.yaml @@ -96,7 +96,6 @@ autoscaling: # targetMemoryUtilizationPercentage: 80 env: - REDIS_URL: "redis://redis-master.db.svc.cluster.local:6379" debug: 0 uws: false redis: false diff --git a/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml index d3d092a8d..20806f4a1 100644 --- a/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/sink/templates/deployment.yaml @@ -59,7 +59,7 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} # Local minio Installation value: 'https://{{ .Values.global.domainName }}:{{.Values.global.ingress.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' {{- else if contains "amazonaws.com" .Values.global.s3.endpoint }} diff --git a/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml index d15cf7c8f..7abca821c 100644 --- a/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/sourcemapreader/templates/deployment.yaml @@ -67,9 +67,9 @@ spec: # 4. Using AWS itself. # AWS uses bucketname.endpoint/object while others use endpoint/bucketname/object - name: ASSETS_ORIGIN - {{- if eq .Values.global.s3.endpoint "sourcemapreader://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} # Local minio Installation - value: 'sourcemapreaders://{{ .Values.global.domainName }}:{{.Values.global.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' + value: 'sourcemapreaders://{{ .Values.global.domainName }}:{{.Values.global.ingress.controller.service.ports.https}}/{{.Values.global.s3.assetsBucket}}' {{- else if contains "amazonaws.com" .Values.global.s3.endpoint }} # AWS S3 # Ref: sourcemapreaders://stackoverflow.com/questions/53634583/go-template-split-string-by-delimiter diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml index 0685c7ad2..0126ba37f 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml @@ -35,7 +35,7 @@ spec: - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml index 7441ca106..8043fdaea 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml @@ -35,7 +35,7 @@ spec: - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml index 92ed861ff..0183d106f 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml @@ -35,7 +35,7 @@ spec: - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' {{- else}} value: '{{ .Values.global.s3.endpoint }}' diff --git a/scripts/helmcharts/openreplay/charts/utilities/values.yaml b/scripts/helmcharts/openreplay/charts/utilities/values.yaml index 670427b8b..2076f8349 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/values.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/values.yaml @@ -55,7 +55,6 @@ sessionsCleaner: # Common env values are from chalice for the crons chalice: env: - ch_host: clickhouse-openreplay-clickhouse.db.svc.cluster.local ch_port: 9000 captcha_server: '' captcha_key: '' diff --git a/scripts/helmcharts/openreplay/files/clickhouse.sh b/scripts/helmcharts/openreplay/files/clickhouse.sh index 8a420e6a9..5b11f4e91 100644 --- a/scripts/helmcharts/openreplay/files/clickhouse.sh +++ b/scripts/helmcharts/openreplay/files/clickhouse.sh @@ -11,7 +11,7 @@ function migrate() { echo "Migrating clickhouse version $version" # For now, we can ignore the clickhouse db inject errors. # TODO: Better error handling in script - clickhouse-client -h clickhouse-openreplay-clickhouse.db.svc.cluster.local --port 9000 --multiquery < ${clickhousedir}/${version}/${version}.sql || true + clickhouse-client -h ${CH_HOST} --port ${CH_PORT} --multiquery < ${clickhousedir}/${version}/${version}.sql || true done } @@ -19,7 +19,7 @@ function init() { echo "Initializing clickhouse" for file in `ls ${clickhousedir}/create/*.sql`; do echo "Injecting $file" - clickhouse-client -h clickhouse-openreplay-clickhouse.db.svc.cluster.local --port 9000 --multiquery < $file || true + clickhouse-client -h ${CH_HOST} --port ${CH_PORT} --multiquery < $file || true done } diff --git a/scripts/helmcharts/openreplay/files/minio.sh b/scripts/helmcharts/openreplay/files/minio.sh index fc0a7238f..34229572c 100644 --- a/scripts/helmcharts/openreplay/files/minio.sh +++ b/scripts/helmcharts/openreplay/files/minio.sh @@ -7,7 +7,8 @@ cd /tmp buckets=("mobs" "sessions-assets" "sourcemaps" "sessions-mobile-assets" "quickwit" "vault-data") -mc alias set minio http://minio.db.svc.cluster.local:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY + +mc alias set minio $MINIO_HOST $MINIO_ACCESS_KEY $MINIO_SECRET_KEY function init() { echo "Initializing minio" diff --git a/scripts/helmcharts/openreplay/files/vault.sh b/scripts/helmcharts/openreplay/files/vault.sh index 159693f28..87670acde 100644 --- a/scripts/helmcharts/openreplay/files/vault.sh +++ b/scripts/helmcharts/openreplay/files/vault.sh @@ -7,7 +7,7 @@ if [ "x$VERBOSE" == "x1" ]; then set -x fi -export VAULT_ADDR=http://databases-vault.db.svc.cluster.local:8200 +export VAULT_ADDR=${VAULT_ADDR} # Check vault is already initialized, if so return diff --git a/scripts/helmcharts/openreplay/templates/job.yaml b/scripts/helmcharts/openreplay/templates/job.yaml index 127809765..d77a1b962 100644 --- a/scripts/helmcharts/openreplay/templates/job.yaml +++ b/scripts/helmcharts/openreplay/templates/job.yaml @@ -50,7 +50,7 @@ spec: error_connection=1 while [ $exit_count -le 20 ];do - nc -zv clickhouse-openreplay-clickhouse.db.svc.cluster.local 9000 -w 1 + nc -zv {{.Values.global.clickhouse.chHost}} 9000 -w 1 if [ $? -ne 0 ]; then echo "[info] clickhouse is not up; retrying in 5 seconds" sleep 4 @@ -103,7 +103,7 @@ spec: mountPath: /opt/openreplay - name: dbmigrationscript mountPath: /opt/migrations/ - {{- if eq .Values.global.s3.endpoint "http://minio.db.svc.cluster.local:9000" }} + {{- if contains "minio" .Values.global.s3.endpoint }} - name: minio image: bitnami/minio:2020.10.9-debian-10-r6 env: @@ -119,6 +119,8 @@ spec: value: "{{ .Values.minio.global.minio.accessKey }}" - name: MINIO_SECRET_KEY value: "{{ .Values.minio.global.minio.secretKey }}" + - name: MINIO_HOST + value: "{{ .Values.global.s3.endpoint }}" command: - /bin/bash - /opt/migrations/dbops.sh @@ -147,6 +149,8 @@ spec: value: "{{ .Values.global.postgresql.postgresqlUser }}" - name: PGPASSWORD value: "{{ .Values.global.postgresql.postgresqlPassword }}" + - name: VAULT_ADDR + value: "{{ .Values.global.vault.vaultHost }}" image: hashicorp/vault:1.12.0 command: - /bin/sh @@ -208,6 +212,10 @@ spec: value: "{{ .Values.fromVersion }}" - name: CHART_APP_VERSION value: "{{ .Chart.AppVersion }}" + - name: CH_HOST + value: "{{.Values.global.clickhouse.chHost}}" + - name: CH_PORT + value: "{{.Values.global.clickhouse.service.webPort}}" command: - /bin/bash - /opt/migrations/dbops.sh diff --git a/scripts/helmcharts/openreplay/values.yaml b/scripts/helmcharts/openreplay/values.yaml index f836866fe..33cc3e178 100644 --- a/scripts/helmcharts/openreplay/values.yaml +++ b/scripts/helmcharts/openreplay/values.yaml @@ -81,3 +81,26 @@ ingress-nginx: ## repository: tag: "v1.3.0" digest: "" + +# For enterpriseEdition Only +vault: &vault + vaultHost: databases-vault.db.svc.cluster.local:8200 + annotations: + vault.hashicorp.com/agent-cache-enable: "true" + vault.hashicorp.com/agent-inject: "true" + vault.hashicorp.com/agent-inject-token: "true" + vault.hashicorp.com/template-static-secret-render-interval: 2m + # vault.hashicorp.com/log-level: debug + vault.hashicorp.com/agent-run-as-same-user: "true" + vault.hashicorp.com/agent-inject-command-processor.properties: | + pkill -TERM openreplay + vault.hashicorp.com/role: pgaccess + vault.hashicorp.com/agent-inject-secret-processor.properties: database/creds/db-app + vault.hashicorp.com/agent-inject-template-processor.properties: | + {{- with secret "database/creds/db-app" -}} + POSTGRES_STRING=postgres://{{.Data.username}}:{{.Data.password}}@postgresql.db.svc.cluster.local:5432/postgres + {{- end -}} + +global: + vault: *vault + clusterDomain: "svc.cluster.local" diff --git a/scripts/helmcharts/vars.yaml b/scripts/helmcharts/vars.yaml index 956d29b73..c77881963 100644 --- a/scripts/helmcharts/vars.yaml +++ b/scripts/helmcharts/vars.yaml @@ -17,9 +17,12 @@ postgresql: &postgres # asdf # cpu: 2 -clickhouse: +clickhouse: &clickhouse # For enterpriseEdition enabled: false + chHost: clickhouse-openreplay-clickhouse.db.svc.cluster.local + service: + webPort: 9000 quickwit: &quickwit # For enterpriseEdition @@ -91,6 +94,7 @@ ingress-nginx: &ingress-nginx force-ssl-redirect: false proxy-body-size: 10m + # Application specific variables global: ingress: *ingress-nginx @@ -98,6 +102,8 @@ global: kafka: *kafka redis: *redis quickwit: *quickwit + clickhouse: *clickhouse + # Registry URL from where the OR images should be pulled. openReplayContainerRegistry: "public.ecr.aws/p1t3u8a3" # secret key to inject to assist and peers service assistKey: "SetARandomStringHere" @@ -172,21 +178,3 @@ chalice: # cpu: 512m # memory: 2056Mi -# For enterpriseEdition Only -vault: - enabled: false - annotations: - vault.hashicorp.com/agent-cache-enable: "true" - vault.hashicorp.com/agent-inject: "true" - vault.hashicorp.com/agent-inject-token: "true" - vault.hashicorp.com/template-static-secret-render-interval: 2m - # vault.hashicorp.com/log-level: debug - vault.hashicorp.com/agent-run-as-same-user: "true" - vault.hashicorp.com/agent-inject-command-processor.properties: | - pkill -TERM openreplay - vault.hashicorp.com/role: pgaccess - vault.hashicorp.com/agent-inject-secret-processor.properties: database/creds/db-app - vault.hashicorp.com/agent-inject-template-processor.properties: | - {{- with secret "database/creds/db-app" -}} - POSTGRES_STRING=postgres://{{.Data.username}}:{{.Data.password}}@postgresql.db.svc.cluster.local:5432/postgres - {{- end -}} From cf13f6fb26ddbfb52847bc5a49572fc534864a91 Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 25 Nov 2022 12:44:17 +0100 Subject: [PATCH 10/23] change(ui): change wording in filters --- .../BugReport/components/StepsComponents/XRay.tsx | 4 ++-- frontend/app/types/session/issue.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx index b8477edc1..802230b9d 100644 --- a/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx @@ -70,7 +70,7 @@ function XRay({ xrayProps, timePointer, stepPickRadius, clearEventSelection, set <>
- XRAY + X-RAY {timePointer > 0 ? ( {Duration.fromMillis(selectedTime).toFormat('hh:mm:ss')} @@ -84,7 +84,7 @@ function XRay({ xrayProps, timePointer, stepPickRadius, clearEventSelection, set >
- Click anywhere on X-RAY to drilldown and add + Click anywhere in the graph below to drilldown and add steps
diff --git a/frontend/app/types/session/issue.js b/frontend/app/types/session/issue.js index d2afff190..308bf32be 100644 --- a/frontend/app/types/session/issue.js +++ b/frontend/app/types/session/issue.js @@ -1,13 +1,13 @@ import Record from 'Types/Record'; import { List } from 'immutable'; import Watchdog from 'Types/watchdog' - export const issues_types = List([ { 'type': 'all', 'visible': true, 'order': 0, 'name': 'All', 'icon': '' }, { 'type': 'js_exception', 'visible': true, 'order': 1, 'name': 'Errors', 'icon': 'funnel/exclamation-circle' }, - { 'type': 'click_rage', 'visible': true, 'order': 2, 'name': 'Click Rage', 'icon': 'funnel/emoji-angry' }, - { 'type': 'crash', 'visible': true, 'order': 3, 'name': 'Crashes', 'icon': 'funnel/file-earmark-break' }, - { 'type': 'memory', 'visible': true, 'order': 4, 'name': 'High Memory', 'icon': 'funnel/sd-card' }, + { 'type': 'bad_request', 'visible': true, 'order': 2, 'name': 'Bad Requests', 'icon': 'funnel/file-medical-alt' }, + { 'type': 'click_rage', 'visible': true, 'order': 3, 'name': 'Click Rage', 'icon': 'funnel/emoji-angry' }, + { 'type': 'crash', 'visible': true, 'order': 4, 'name': 'Crashes', 'icon': 'funnel/file-earmark-break' }, + // { 'type': 'memory', 'visible': true, 'order': 4, 'name': 'High Memory', 'icon': 'funnel/sd-card' }, // { 'type': 'vault', 'visible': true, 'order': 5, 'name': 'Vault', 'icon': 'safe' }, // { 'type': 'bookmark', 'visible': true, 'order': 5, 'name': 'Bookmarks', 'icon': 'safe' }, // { 'type': 'bad_request', 'visible': true, 'order': 1, 'name': 'Bad Requests', 'icon': 'funnel/file-medical-alt' }, From a53783cbeaa98b2b53bf992dd42661da8723dab5 Mon Sep 17 00:00:00 2001 From: Mehdi Osman Date: Fri, 25 Nov 2022 12:54:57 +0100 Subject: [PATCH 11/23] Update .env.sample --- frontend/.env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/.env.sample b/frontend/.env.sample index c5f9530a6..33c67be52 100644 --- a/frontend/.env.sample +++ b/frontend/.env.sample @@ -23,4 +23,4 @@ MINIO_SECRET_KEY = '' # APP and TRACKER VERSIONS VERSION = '1.9.0' -TRACKER_VERSION = '4.1.6' +TRACKER_VERSION = '4.1.7' From 68e77a504cdd249c1d3c912367d827ce5a5d38a5 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 25 Nov 2022 13:30:31 +0100 Subject: [PATCH 12/23] feat(chalice): changed funnels --- api/chalicelib/core/significance.py | 3 ++- ee/api/chalicelib/core/significance.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/chalicelib/core/significance.py b/api/chalicelib/core/significance.py index a38dc82d1..52a22aee8 100644 --- a/api/chalicelib/core/significance.py +++ b/api/chalicelib/core/significance.py @@ -213,8 +213,9 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: AND ISE.timestamp <= stages_t.stage{i + 1}_timestamp AND ISS.project_id=%(project_id)s AND ISE.session_id = stages_t.session_id + AND ISS.type!='custom' -- ignore custom issues because they are massive {"AND ISS.type IN %(issueTypes)s" if len(filter_issues) > 0 else ""} - LIMIT 20 -- remove the limit to get exact stats + LIMIT 50 -- remove the limit to get exact stats ) AS issues_t ON (TRUE) ) AS stages_and_issues_t INNER JOIN sessions USING(session_id); """ diff --git a/ee/api/chalicelib/core/significance.py b/ee/api/chalicelib/core/significance.py index 75df1cd94..d2ad650b4 100644 --- a/ee/api/chalicelib/core/significance.py +++ b/ee/api/chalicelib/core/significance.py @@ -220,8 +220,9 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: AND ISE.timestamp <= stages_t.stage{i + 1}_timestamp AND ISS.project_id=%(project_id)s AND ISE.session_id = stages_t.session_id + AND ISS.type!='custom' -- ignore custom issues because they are massive {"AND ISS.type IN %(issueTypes)s" if len(filter_issues) > 0 else ""} - LIMIT 20 -- remove the limit to get exact stats + LIMIT 50 -- remove the limit to get exact stats ) AS issues_t ON (TRUE) ) AS stages_and_issues_t INNER JOIN sessions USING(session_id); """ From 8579231f487b7544252fb394f82ca7ccd3d09d19 Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 25 Nov 2022 15:17:16 +0100 Subject: [PATCH 13/23] fix(ui): fix styling for guide popup --- .../components/StepsComponents/EventStep.tsx | 2 +- .../app/components/Session_/components/NotePopup.tsx | 6 +----- .../app/components/shared/GuidePopup/GuidePopup.tsx | 12 +++++++----- .../app/components/shared/XRayButton/XRayButton.tsx | 5 ++++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx index fb0dc5b98..255cac92b 100644 --- a/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/EventStep.tsx @@ -50,7 +50,7 @@ function Step({ step, ind, isDefault }: { step: IStep; ind: number; isDefault?: >
{ind + 1}
-
+
{durationFromMs(step.time)}
{/* @ts-ignore */} diff --git a/frontend/app/components/Session_/components/NotePopup.tsx b/frontend/app/components/Session_/components/NotePopup.tsx index 7c5ea49f4..83201fc57 100644 --- a/frontend/app/components/Session_/components/NotePopup.tsx +++ b/frontend/app/components/Session_/components/NotePopup.tsx @@ -26,11 +26,7 @@ function NotePopup({ return ( - Introducing Notes -
- } + title="Introducing Notes" description={'Annotate session replays and share your feedback with the rest of your team.'} >
-
{title}
-
{description}
-
+
{title}
+
{description}
+
} open={true} @@ -67,6 +67,8 @@ export default function GuidePopup({ children, title, description }: IProps) {
) : ( - children + <> + {children} + ); } diff --git a/frontend/app/components/shared/XRayButton/XRayButton.tsx b/frontend/app/components/shared/XRayButton/XRayButton.tsx index 98368da21..58daaa070 100644 --- a/frontend/app/components/shared/XRayButton/XRayButton.tsx +++ b/frontend/app/components/shared/XRayButton/XRayButton.tsx @@ -12,7 +12,10 @@ interface Props { } function XRayButton(props: Props) { const { isActive } = props; - const [showGuide, setShowGuide] = useState(!localStorage.getItem(FEATURE_KEYS.XRAY)); + // const [showGuide, setShowGuide] = useState(!localStorage.getItem(FEATURE_KEYS.XRAY)); + const showGuide = false; + const setShowGuide = (anyt: any) => anyt; + useEffect(() => { if (!showGuide) { return; From 0d15ea6854e8413dac66c8604b8493a2388cc02a Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 25 Nov 2022 15:20:38 +0100 Subject: [PATCH 14/23] fix(ui): fix styling for xray --- .../BugReport/components/StepsComponents/XRay.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx b/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx index 802230b9d..61c2fb9da 100644 --- a/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx +++ b/frontend/app/components/Session_/BugReport/components/StepsComponents/XRay.tsx @@ -79,14 +79,11 @@ function XRay({ xrayProps, timePointer, stepPickRadius, clearEventSelection, set
{!shouldShowPointerReset ? (
-
- Click anywhere in the graph below to drilldown and add - steps -
+
Click anywhere in the graph below to drilldown and add steps
) : ( )}
-
+
Date: Tue, 9 Aug 2022 17:00:20 +0200 Subject: [PATCH 15/23] feat(postgresql): provide credentials using secrets - Compatible with `postgresql.existingSecret` in the postgresql chart. - Uses dependent environment variables for `POSTGRES_STRING` connection strings --- .../charts/alerts/templates/deployment.yaml | 7 +++++++ .../charts/chalice/templates/deployment.yaml | 7 +++++++ .../openreplay/charts/db/templates/deployment.yaml | 13 +++++++++++-- .../charts/ender/templates/deployment.yaml | 11 ++++++++++- .../charts/frontend/templates/deployment.yaml | 11 ++++++++++- .../charts/http/templates/deployment.yaml | 11 ++++++++++- .../charts/integrations/templates/deployment.yaml | 11 ++++++++++- .../charts/utilities/templates/report-cron.yaml | 7 +++++++ .../utilities/templates/sessions-cleaner-cron.yaml | 7 +++++++ .../charts/utilities/templates/telemetry-cron.yaml | 7 +++++++ scripts/helmcharts/openreplay/templates/job.yaml | 9 ++++++++- 11 files changed, 94 insertions(+), 7 deletions(-) diff --git a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml index 24d40bf21..55f81f410 100644 --- a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml @@ -58,7 +58,14 @@ spec: - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index f4c04f4ad..a9f1c02e9 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -68,7 +68,14 @@ spec: - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST diff --git a/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml index 3ffd981a9..02831fa73 100644 --- a/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/db/templates/deployment.yaml @@ -53,10 +53,19 @@ spec: value: '{{ .Values.global.kafka.kafkaHost }}:{{ .Values.global.kafka.kafkaPort }}' - name: KAFKA_USE_SSL value: '{{ .Values.global.kafka.kafkaUseSsl }}' - - name: POSTGRES_STRING - value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:{{ .Values.global.postgresql.postgresqlPassword }}@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' + - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: QUICKWIT_ENABLED value: '{{ .Values.global.quickwit.enabled }}' + - name: POSTGRES_STRING + value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:$(pg_password)@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' {{- range $key, $val := .Values.env }} - name: {{ $key }} value: '{{ $val }}' diff --git a/scripts/helmcharts/openreplay/charts/ender/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/ender/templates/deployment.yaml index 808578b76..22713eee8 100644 --- a/scripts/helmcharts/openreplay/charts/ender/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/ender/templates/deployment.yaml @@ -51,8 +51,17 @@ spec: value: '{{ .Values.global.kafka.kafkaHost }}:{{ .Values.global.kafka.kafkaPort }}' - name: KAFKA_USE_SSL value: '{{ .Values.global.kafka.kafkaUseSsl }}' + - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: POSTGRES_STRING - value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:{{ .Values.global.postgresql.postgresqlPassword }}@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' + value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:$(pg_password)@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' {{- range $key, $val := .Values.env }} - name: {{ $key }} value: '{{ $val }}' diff --git a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml index 92d1b7002..7ee425824 100644 --- a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml @@ -57,8 +57,17 @@ spec: value: '{{ .Values.global.kafka.kafkaHost }}:{{ .Values.global.kafka.kafkaPort }}' - name: KAFKA_USE_SSL value: '{{ .Values.global.kafka.kafkaUseSsl }}' + - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: POSTGRES_STRING - value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:{{ .Values.global.postgresql.postgresqlPassword }}@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' + value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:$(pg_password)@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' # We need to check what is the object store endpoint. # There can be 4 options # 1. Using minio inside kube clster diff --git a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml index d0f18cba6..5a835e3fe 100644 --- a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml @@ -57,8 +57,17 @@ spec: value: '{{ .Values.global.kafka.kafkaHost }}:{{ .Values.global.kafka.kafkaPort }}' - name: KAFKA_USE_SSL value: '{{ .Values.global.kafka.kafkaUseSsl }}' + - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: POSTGRES_STRING - value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:{{ .Values.global.postgresql.postgresqlPassword }}@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' + value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:$(pg_password)@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' # We need to check what is the object store endpoint. # There can be 4 options # 1. Using minio inside kube clster diff --git a/scripts/helmcharts/openreplay/charts/integrations/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/integrations/templates/deployment.yaml index 910db4bae..618d32f47 100644 --- a/scripts/helmcharts/openreplay/charts/integrations/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/integrations/templates/deployment.yaml @@ -51,8 +51,17 @@ spec: value: '{{ .Values.global.kafka.kafkaHost }}:{{ .Values.global.kafka.kafkaPort }}' - name: KAFKA_USE_SSL value: '{{ .Values.global.kafka.kafkaUseSsl }}' + - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: POSTGRES_STRING - value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:{{ .Values.global.postgresql.postgresqlPassword }}@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' + value: 'postgres://{{ .Values.global.postgresql.postgresqlUser }}:$(pg_password)@{{ .Values.global.postgresql.postgresqlHost }}:{{ .Values.global.postgresql.postgresqlPort }}/{{ .Values.global.postgresql.postgresqlDatabase }}' {{- range $key, $val := .Values.env }} - name: {{ $key }} value: '{{ $val }}' diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml index 0126ba37f..96e17acf5 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml @@ -31,7 +31,14 @@ spec: - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml index 8043fdaea..74e65b281 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml @@ -31,7 +31,14 @@ spec: - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml index 0183d106f..8b81ee057 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml @@ -31,7 +31,14 @@ spec: - name: pg_user value: '{{ .Values.global.postgresql.postgresqlUser }}' - name: pg_password + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} - name: SITE_URL value: 'https://{{ .Values.global.domainName }}' - name: S3_HOST diff --git a/scripts/helmcharts/openreplay/templates/job.yaml b/scripts/helmcharts/openreplay/templates/job.yaml index d77a1b962..aaadc2eb7 100644 --- a/scripts/helmcharts/openreplay/templates/job.yaml +++ b/scripts/helmcharts/openreplay/templates/job.yaml @@ -91,7 +91,14 @@ spec: - name: PGUSER value: "{{ .Values.global.postgresql.postgresqlUser }}" - name: PGPASSWORD - value: "{{ .Values.global.postgresql.postgresqlPassword }}" + {{- if .Values.global.postgresql.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.postgresql.existingSecret }} + key: postgresql-postgres-password + {{- else }} + value: '{{ .Values.global.postgresql.postgresqlPassword }}' + {{- end}} image: bitnami/postgresql:13.3.0-debian-10-r53 command: - /bin/bash From e501bee2ff74c1f58b66dd7ec4307ce04b4358d3 Mon Sep 17 00:00:00 2001 From: Jorgen Evens Date: Wed, 10 Aug 2022 10:16:38 +0200 Subject: [PATCH 16/23] feat(s3): provide credentials using secrets - Compatible with `minio.existingSecret` in the minio chart. --- .../charts/alerts/templates/deployment.yaml | 14 ++++++++++++++ .../charts/assets/templates/deployment.yaml | 14 ++++++++++++++ .../charts/assist/templates/deployment.yaml | 14 ++++++++++++++ .../charts/chalice/templates/deployment.yaml | 14 ++++++++++++++ .../charts/frontend/templates/deployment.yaml | 14 ++++++++++++++ .../charts/http/templates/deployment.yaml | 14 ++++++++++++++ .../charts/peers/templates/deployment.yaml | 7 +++++++ .../charts/storage/templates/deployment.yaml | 14 ++++++++++++++ .../charts/utilities/templates/report-cron.yaml | 14 ++++++++++++++ .../utilities/templates/sessions-cleaner-cron.yaml | 14 ++++++++++++++ .../charts/utilities/templates/telemetry-cron.yaml | 14 ++++++++++++++ 11 files changed, 147 insertions(+) diff --git a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml index 55f81f410..ac01dbdac 100644 --- a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml @@ -75,9 +75,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_DEFAULT_REGION value: '{{ .Values.global.s3.region }}' - name: EMAIL_HOST diff --git a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml index 47a79be24..350054599 100644 --- a/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/assets/templates/deployment.yaml @@ -44,9 +44,23 @@ spec: {{- end}} env: - name: AWS_ACCESS_KEY_ID + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: AWS_SECRET_ACCESS_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: S3_BUCKET_ASSETS value: {{ .Values.global.s3.assetsBucket }} - name: LICENSE_KEY diff --git a/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml index eb6ada0da..e153e50c3 100644 --- a/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/assist/templates/deployment.yaml @@ -56,9 +56,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: REDIS_URL value: {{ .Values.global.redis.redisHost }} {{- range $key, $val := .Values.env }} diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index a9f1c02e9..30b02b563 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -85,9 +85,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_DEFAULT_REGION value: '{{ .Values.global.s3.region }}' - name: sessions_region diff --git a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml index 7ee425824..c41dc1313 100644 --- a/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/frontend/templates/deployment.yaml @@ -44,9 +44,23 @@ spec: {{- end}} env: - name: AWS_ACCESS_KEY_ID + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: AWS_SECRET_ACCESS_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_REGION value: '{{ .Values.global.s3.region }}' - name: LICENSE_KEY diff --git a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml index 5a835e3fe..6322ab754 100644 --- a/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/http/templates/deployment.yaml @@ -44,9 +44,23 @@ spec: {{- end}} env: - name: AWS_ACCESS_KEY_ID + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: AWS_SECRET_ACCESS_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_REGION value: '{{ .Values.global.s3.region }}' - name: LICENSE_KEY diff --git a/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml index cef60a000..2cbd395d9 100644 --- a/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/peers/templates/deployment.yaml @@ -46,7 +46,14 @@ spec: - name: ASSIST_KEY value: {{ .Values.global.assistKey }} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} {{- range $key, $val := .Values.env }} - name: {{ $key }} value: '{{ $val }}' diff --git a/scripts/helmcharts/openreplay/charts/storage/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/storage/templates/deployment.yaml index 321bf0745..6a60e3ab3 100644 --- a/scripts/helmcharts/openreplay/charts/storage/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/storage/templates/deployment.yaml @@ -44,9 +44,23 @@ spec: {{- end}} env: - name: AWS_ACCESS_KEY_ID + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: AWS_SECRET_ACCESS_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_ENDPOINT value: '{{ .Values.global.s3.endpoint }}' - name: AWS_REGION_WEB diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml index 96e17acf5..17fa52720 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml @@ -48,9 +48,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_DEFAULT_REGION value: '{{ .Values.global.s3.region }}' - name: sessions_region diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml index 74e65b281..49bc8cfed 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml @@ -48,9 +48,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_DEFAULT_REGION value: '{{ .Values.global.s3.region }}' - name: sessions_region diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml index 8b81ee057..b9044664f 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml @@ -48,9 +48,23 @@ spec: value: '{{ .Values.global.s3.endpoint }}' {{- end}} - name: S3_KEY + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: access-key + {{- else }} value: {{ .Values.global.s3.accessKey }} + {{- end }} - name: S3_SECRET + {{- if .Values.global.s3.existingSecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.global.s3.existingSecret }} + key: secret-key + {{- else }} value: {{ .Values.global.s3.secretKey }} + {{- end }} - name: AWS_DEFAULT_REGION value: '{{ .Values.global.s3.region }}' - name: sessions_region From aa7d0771dc824211165269ac956de367302e465b Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 25 Nov 2022 15:27:58 +0100 Subject: [PATCH 17/23] fix(ui): fix search cols --- .../shared/Filters/FilterModal/FilterModal.module.css | 3 ++- .../app/components/shared/Filters/FilterModal/FilterModal.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/shared/Filters/FilterModal/FilterModal.module.css b/frontend/app/components/shared/Filters/FilterModal/FilterModal.module.css index 463a7a2a9..37cf966c6 100644 --- a/frontend/app/components/shared/Filters/FilterModal/FilterModal.module.css +++ b/frontend/app/components/shared/Filters/FilterModal/FilterModal.module.css @@ -10,6 +10,7 @@ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; + max-width: 200px; &:hover { background-color: $active-blue; color: $teal !important; @@ -34,4 +35,4 @@ overflow: hidden; text-overflow: ellipsis; } -} \ No newline at end of file +} diff --git a/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx b/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx index c833583f7..381494abc 100644 --- a/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx +++ b/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx @@ -64,10 +64,10 @@ function FilterModal(props: Props) { // console.log(matchingFilters) return (
-
+
1 ? 'auto 200px' : 1 }}> {matchingCategories.map((key) => { return ( -
+
{key}
{matchingFilters[key] && matchingFilters[key].map((filter: any) => ( From 089610e3102964973be04263847c277d3dd3e50b Mon Sep 17 00:00:00 2001 From: sylenien Date: Fri, 25 Nov 2022 15:46:18 +0100 Subject: [PATCH 18/23] fix(ui): fix search case --- .../components/shared/Filters/FilterModal/FilterModal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx b/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx index 381494abc..421a12837 100644 --- a/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx +++ b/frontend/app/components/shared/Filters/FilterModal/FilterModal.tsx @@ -8,19 +8,19 @@ import { filtersMap } from 'Types/filter/newFilter'; export const getMatchingEntries = (searchQuery: string, filters: Record) => { const matchingCategories: string[] = []; const matchingFilters: Record = {}; - - if (searchQuery.length === 0) return { + const lowerCaseQuery = searchQuery.toLowerCase(); + if (lowerCaseQuery.length === 0) return { matchingCategories: Object.keys(filters), matchingFilters: filters, }; Object.keys(filters).forEach(name => { - if (name.toLocaleLowerCase().includes(searchQuery)) { + if (name.toLocaleLowerCase().includes(lowerCaseQuery)) { matchingCategories.push(name); matchingFilters[name] = filters[name]; } else { const filtersQuery = filters[name] - .filter(filterOption => filterOption.label.toLocaleLowerCase().includes(searchQuery)) + .filter((filterOption: any) => filterOption.label.toLocaleLowerCase().includes(lowerCaseQuery)) if (filtersQuery.length > 0) matchingFilters[name] = filtersQuery filtersQuery.length > 0 && matchingCategories.push(name); From f4fbeee1002d8bc6132568214341f58142eca538 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 25 Nov 2022 15:47:40 +0100 Subject: [PATCH 19/23] feat(chalice): fixed duplicate projects list --- ee/api/chalicelib/core/projects.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ee/api/chalicelib/core/projects.py b/ee/api/chalicelib/core/projects.py index cf18cc0a9..f2d7ebfdb 100644 --- a/ee/api/chalicelib/core/projects.py +++ b/ee/api/chalicelib/core/projects.py @@ -51,6 +51,7 @@ def get_projects(tenant_id, recording_state=False, gdpr=None, recorded=False, st AND users.deleted_at ISNULL AND users.tenant_id = %(tenant_id)s AND (roles.all_projects OR roles_projects.project_id = s.project_id) + LIMIT 1 ) AS role_project ON (TRUE)""" extra_projection = "" extra_join = "" From 4e78f2ddc7666fa0eae41df358bac2b79f0c8b94 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Fri, 25 Nov 2022 14:57:01 +0000 Subject: [PATCH 20/23] skipping flaky plugin --- .github/workflows/workers-ee.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workers-ee.yaml b/.github/workflows/workers-ee.yaml index e434d2716..723151287 100644 --- a/.github/workflows/workers-ee.yaml +++ b/.github/workflows/workers-ee.yaml @@ -26,13 +26,13 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # We need to diff with old commit - # to see which workers got changed. - fetch-depth: 2 - # ref: staging + # - name: Checkout + # uses: actions/checkout@v2 + # with: + # # We need to diff with old commit + # # to see which workers got changed. + # fetch-depth: 2 + # # ref: staging - name: Docker login run: | From a903d5c1b7ca604aedc2be097d3a354dd6f99bf0 Mon Sep 17 00:00:00 2001 From: Alex Kaminskii Date: Fri, 25 Nov 2022 16:00:25 +0100 Subject: [PATCH 21/23] feat/fix(tracker):4.1.8:recalculate timeOrigin on start --- tracker/tracker/package.json | 2 +- tracker/tracker/src/main/app/index.ts | 4 +++- tracker/tracker/src/main/modules/timing.ts | 4 ++-- tracker/tracker/src/main/modules/viewport.ts | 4 +++- tracker/tracker/src/main/utils.ts | 17 ++++++++++++----- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index 223d96839..8e16b6c54 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "4.1.7", + "version": "4.1.8", "keywords": [ "logging", "replay" diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index ce2473ef5..bec00d01b 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -1,6 +1,6 @@ import type Message from './messages.gen.js' import { Timestamp, Metadata, UserID } from './messages.gen.js' -import { now, deprecationWarn } from '../utils.js' +import { now, adjustTimeOrigin, deprecationWarn } from '../utils.js' import Nodes from './nodes.js' import Observer from './observer/top_observer.js' import Sanitizer from './sanitizer.js' @@ -369,6 +369,7 @@ export default class App { this.sessionStorage.removeItem(this.options.session_reset_key) } } + private _start(startOpts: StartOptions = {}, resetByWorker = false): Promise { if (!this.worker) { return Promise.resolve(UnsuccessfulStart('No worker found: perhaps, CSP is not set.')) @@ -381,6 +382,7 @@ export default class App { ) } this.activityState = ActivityState.Starting + adjustTimeOrigin() if (startOpts.sessionHash) { this.session.applySessionHash(startOpts.sessionHash) diff --git a/tracker/tracker/src/main/modules/timing.ts b/tracker/tracker/src/main/modules/timing.ts index 2cb1e1767..f2d2cbf11 100644 --- a/tracker/tracker/src/main/modules/timing.ts +++ b/tracker/tracker/src/main/modules/timing.ts @@ -226,13 +226,13 @@ export default function (app: App, opts: Partial): void { paintBlocks === null ? 0 : calculateSpeedIndex(firstContentfulPaint || firstPaint, paintBlocks) + const { domContentLoadedEventEnd, navigationStart } = performance.timing const timeToInteractive = interactiveWindowTickTime === null ? Math.max( interactiveWindowStartTime, firstContentfulPaint, - performance.timing.domContentLoadedEventEnd - performance.timing.navigationStart || - 0, + domContentLoadedEventEnd - navigationStart || 0, ) : 0 app.send( diff --git a/tracker/tracker/src/main/modules/viewport.ts b/tracker/tracker/src/main/modules/viewport.ts index e17a70359..9541f085e 100644 --- a/tracker/tracker/src/main/modules/viewport.ts +++ b/tracker/tracker/src/main/modules/viewport.ts @@ -1,9 +1,10 @@ import type App from '../app/index.js' +import { getTimeOrigin } from '../utils.js' import { SetPageLocation, SetViewportSize, SetPageVisibility } from '../app/messages.gen.js' export default function (app: App): void { let url: string, width: number, height: number - let navigationStart = performance.timing.navigationStart + let navigationStart: number const sendSetPageLocation = app.safe(() => { const { URL } = document @@ -30,6 +31,7 @@ export default function (app: App): void { app.attachStartCallback(() => { url = '' + navigationStart = getTimeOrigin() width = height = -1 sendSetPageLocation() sendSetViewportSize() diff --git a/tracker/tracker/src/main/utils.ts b/tracker/tracker/src/main/utils.ts index 8ed47096d..739821ea9 100644 --- a/tracker/tracker/src/main/utils.ts +++ b/tracker/tracker/src/main/utils.ts @@ -6,12 +6,19 @@ export const IS_FIREFOX = IN_BROWSER && navigator.userAgent.match(/firefox|fxios export const MAX_STR_LEN = 1e5 -const navigationStart: number | false = - IN_BROWSER && (performance.timing.navigationStart || performance.timeOrigin) -// performance.now() is buggy in some browsers +// Buggy to use `performance.timeOrigin || performance.timing.navigationStart` +// https://github.com/mdn/content/issues/4713 +// Maybe move to timer/ticker +let timeOrigin: number = IN_BROWSER ? Date.now() - performance.now() : 0 +export function adjustTimeOrigin() { + timeOrigin = Date.now() - performance.now() +} +export function getTimeOrigin() { + return timeOrigin +} export const now: () => number = - IN_BROWSER && performance.now() && navigationStart - ? () => Math.round(performance.now() + navigationStart) + IN_BROWSER && !!performance.now + ? () => Math.round(performance.now() + timeOrigin) : () => Date.now() export const stars: (str: string) => string = From 8ef340307346d9182ab58914403b38e74f0906c1 Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Fri, 25 Nov 2022 15:01:34 +0000 Subject: [PATCH 22/23] skip flaky build --- .github/workflows/workers-ee.yaml | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/workers-ee.yaml b/.github/workflows/workers-ee.yaml index 723151287..c573dff26 100644 --- a/.github/workflows/workers-ee.yaml +++ b/.github/workflows/workers-ee.yaml @@ -26,13 +26,13 @@ jobs: runs-on: ubuntu-latest steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # # We need to diff with old commit - # # to see which workers got changed. - # fetch-depth: 2 - # # ref: staging + - name: Checkout + uses: actions/checkout@v2 + with: + # We need to diff with old commit + # to see which workers got changed. + fetch-depth: 2 + # ref: staging - name: Docker login run: | @@ -161,16 +161,16 @@ jobs: # Deploy command helm template openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --set ingress-nginx.enabled=false --set skipMigration=true | kubectl apply -f - - - name: Alert slack - if: ${{ failure() }} - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: ee - SLACK_TITLE: "Failed ${{ github.workflow }}" - SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff' - SLACK_WEBHOOK: ${{ secrets.SLACK_WEB_HOOK }} - SLACK_USERNAME: "OR Bot" - SLACK_MESSAGE: 'Build failed :bomb:' + #- name: Alert slack + # if: ${{ failure() }} + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: ee + # SLACK_TITLE: "Failed ${{ github.workflow }}" + # SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff' + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEB_HOOK }} + # SLACK_USERNAME: "OR Bot" + # SLACK_MESSAGE: 'Build failed :bomb:' # - name: Debug Job From 0e99cd7c593b88ce425479d89b21474e58f56cfd Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 25 Nov 2022 16:54:33 +0100 Subject: [PATCH 23/23] feat(ui) - autoplay with pagination and checking for latest sessions, also a fix --- .../Autoplay/{Autoplay.js => Autoplay.tsx} | 63 ++++++-- .../Session_/Autoplay/{index.js => index.ts} | 0 .../SessionListContainer.tsx | 2 + .../LatestSessionsMessage.tsx | 31 ++++ .../components/LatestSessionsMessage/index.ts | 1 + .../components/SessionList/SessionList.tsx | 41 +++-- frontend/app/duck/search.js | 142 ++++++++++++------ frontend/app/duck/sessions.js | 22 ++- 8 files changed, 232 insertions(+), 70 deletions(-) rename frontend/app/components/Session_/Autoplay/{Autoplay.js => Autoplay.tsx} (59%) rename frontend/app/components/Session_/Autoplay/{index.js => index.ts} (100%) create mode 100644 frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/LatestSessionsMessage.tsx create mode 100644 frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/index.ts diff --git a/frontend/app/components/Session_/Autoplay/Autoplay.js b/frontend/app/components/Session_/Autoplay/Autoplay.tsx similarity index 59% rename from frontend/app/components/Session_/Autoplay/Autoplay.js rename to frontend/app/components/Session_/Autoplay/Autoplay.tsx index 63fdf6841..a83aa3997 100644 --- a/frontend/app/components/Session_/Autoplay/Autoplay.js +++ b/frontend/app/components/Session_/Autoplay/Autoplay.tsx @@ -4,13 +4,52 @@ import { setAutoplayValues } from 'Duck/sessions'; import { session as sessionRoute } from 'App/routes'; import { Link, Icon, Toggler, Tooltip } from 'UI'; import { Controls as PlayerControls, connectPlayer } from 'Player'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; import cn from 'classnames'; +import { fetchAutoplaySessions } from 'Duck/search'; -function Autoplay(props) { - const { previousId, nextId, autoplay, disabled } = props; +const PER_PAGE = 10; + +interface Props extends RouteComponentProps { + previousId: string; + nextId: string; + autoplay: boolean; + defaultList: any; + currentPage: number; + total: number; + setAutoplayValues?: () => void; + toggleAutoplay?: () => void; + latestRequestTime: any; + sessionIds: any; + fetchAutoplaySessions?: (page: number) => Promise; +} +function Autoplay(props: Props) { + const { + previousId, + nextId, + currentPage, + total, + autoplay, + sessionIds, + latestRequestTime, + match: { + // @ts-ignore + params: { siteId, sessionId }, + }, + } = props; + const disabled = sessionIds.length === 0; useEffect(() => { - props.setAutoplayValues(); + if (latestRequestTime) { + props.setAutoplayValues(); + const totalPages = Math.ceil(total / PER_PAGE); + const index = sessionIds.indexOf(sessionId); + + // check for the last page and load the next + if (currentPage !== totalPages && index === sessionIds.length - 1) { + props.fetchAutoplaySessions(currentPage + 1).then(props.setAutoplayValues); + } + } }, []); return ( @@ -62,21 +101,23 @@ function Autoplay(props) { ); } -const connectAutoplay = connect( - (state) => ({ +export default connect( + (state: any) => ({ previousId: state.getIn(['sessions', 'previousId']), nextId: state.getIn(['sessions', 'nextId']), + currentPage: state.getIn(['search', 'currentPage']) || 1, + total: state.getIn(['sessions', 'total']) || 0, + sessionIds: state.getIn(['sessions', 'sessionIds']) || [], + latestRequestTime: state.getIn(['search', 'latestRequestTime']), }), - { setAutoplayValues } -); - -export default connectAutoplay( + { setAutoplayValues, fetchAutoplaySessions } +)( connectPlayer( - (state) => ({ + (state: any) => ({ autoplay: state.autoplay, }), { toggleAutoplay: PlayerControls.toggleAutoplay, } - )(Autoplay) + )(withRouter(Autoplay)) ); diff --git a/frontend/app/components/Session_/Autoplay/index.js b/frontend/app/components/Session_/Autoplay/index.ts similarity index 100% rename from frontend/app/components/Session_/Autoplay/index.js rename to frontend/app/components/Session_/Autoplay/index.ts diff --git a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx index d61208fc7..6a863e69b 100644 --- a/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx +++ b/frontend/app/components/shared/SessionListContainer/SessionListContainer.tsx @@ -4,6 +4,7 @@ import SessionHeader from './components/SessionHeader'; import NotesList from './components/Notes/NoteList'; import { connect } from 'react-redux'; import { fetchList as fetchMembers } from 'Duck/member'; +import LatestSessionsMessage from './components/LatestSessionsMessage'; function SessionListContainer({ activeTab, @@ -21,6 +22,7 @@ function SessionListContainer({
+ {activeTab !== 'notes' ? : }
); diff --git a/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/LatestSessionsMessage.tsx b/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/LatestSessionsMessage.tsx new file mode 100644 index 000000000..c1283d357 --- /dev/null +++ b/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/LatestSessionsMessage.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { updateCurrentPage } from 'Duck/search'; +import { numberWithCommas } from 'App/utils' + +interface Props { + latestSessions: any; + updateCurrentPage: (page: number) => void; +} +function LatestSessionsMessage(props: Props) { + const { latestSessions = [] } = props; + const count = latestSessions.length; + return count > 0 ? ( +
props.updateCurrentPage(1)} + > + Show {numberWithCommas(count)} new Sessions +
+ ) : ( + <> + ); +} + +export default connect( + (state: any) => ({ + latestSessions: state.getIn(['search', 'latestList']), + }), + { updateCurrentPage } +)(LatestSessionsMessage); diff --git a/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/index.ts b/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/index.ts new file mode 100644 index 000000000..8142abba2 --- /dev/null +++ b/frontend/app/components/shared/SessionListContainer/components/LatestSessionsMessage/index.ts @@ -0,0 +1 @@ +export { default } from './LatestSessionsMessage'; diff --git a/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx b/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx index c37b2b63d..97c02d4ca 100644 --- a/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx +++ b/frontend/app/components/shared/SessionListContainer/components/SessionList/SessionList.tsx @@ -9,24 +9,25 @@ import { addFilterByKeyAndValue, updateCurrentPage, setScrollPosition, + checkForLatestSessions, } from 'Duck/search'; import useTimeout from 'App/hooks/useTimeout'; import { numberWithCommas } from 'App/utils'; import { fetchListActive as fetchMetadata } from 'Duck/customField'; enum NoContentType { - Bookmarked, - Vaulted, - ToDate, + Bookmarked, + Vaulted, + ToDate, } const AUTOREFRESH_INTERVAL = 5 * 60 * 1000; -const PER_PAGE = 10; let sessionTimeOut: any = null; interface Props { loading: boolean; list: any; currentPage: number; + pageSize: number; total: number; filters: any; lastPlayedSessionId: string; @@ -39,13 +40,15 @@ interface Props { fetchMetadata: () => void; activeTab: any; isEnterprise?: boolean; + checkForLatestSessions: () => void; } function SessionList(props: Props) { - const [noContentType, setNoContentType] = React.useState(NoContentType.ToDate) + const [noContentType, setNoContentType] = React.useState(NoContentType.ToDate); const { loading, list, currentPage, + pageSize, total, filters, lastPlayedSessionId, @@ -60,19 +63,19 @@ function SessionList(props: Props) { const isVault = isBookmark && isEnterprise; const NO_CONTENT = React.useMemo(() => { if (isBookmark && !isEnterprise) { - setNoContentType(NoContentType.Bookmarked) + setNoContentType(NoContentType.Bookmarked); return { icon: ICONS.NO_BOOKMARKS, message: 'No sessions bookmarked.', }; } else if (isVault) { - setNoContentType(NoContentType.Vaulted) + setNoContentType(NoContentType.Vaulted); return { icon: ICONS.NO_SESSIONS_IN_VAULT, message: 'No sessions found in vault.', }; } - setNoContentType(NoContentType.ToDate) + setNoContentType(NoContentType.ToDate); return { icon: ICONS.NO_SESSIONS, message: 'No relevant sessions found for the selected time period.', @@ -81,7 +84,7 @@ function SessionList(props: Props) { useTimeout(() => { if (!document.hidden) { - props.fetchSessions(null, true); + props.checkForLatestSessions(); } }, AUTOREFRESH_INTERVAL); @@ -107,7 +110,7 @@ function SessionList(props: Props) { sessionTimeOut = setTimeout(function () { if (!document.hidden) { - props.fetchSessions(null, true); + props.checkForLatestSessions(); } }, 5000); }; @@ -182,15 +185,15 @@ function SessionList(props: Props) { {total > 0 && (
- Showing {(currentPage - 1) * PER_PAGE + 1} to{' '} - {(currentPage - 1) * PER_PAGE + list.size} of{' '} + Showing {(currentPage - 1) * pageSize + 1} to{' '} + {(currentPage - 1) * pageSize + list.size} of{' '} {numberWithCommas(total)} sessions.
props.updateCurrentPage(page)} - limit={PER_PAGE} + limit={pageSize} debounceRequest={1000} />
@@ -210,7 +213,15 @@ export default connect( total: state.getIn(['sessions', 'total']) || 0, scrollY: state.getIn(['search', 'scrollY']), activeTab: state.getIn(['search', 'activeTab']), + pageSize: state.getIn(['search', 'pageSize']), isEnterprise: state.getIn(['user', 'account', 'edition']) === 'ee', }), - { updateCurrentPage, addFilterByKeyAndValue, setScrollPosition, fetchSessions, fetchMetadata } + { + updateCurrentPage, + addFilterByKeyAndValue, + setScrollPosition, + fetchSessions, + fetchMetadata, + checkForLatestSessions, + } )(SessionList); diff --git a/frontend/app/duck/search.js b/frontend/app/duck/search.js index 3c3aea8fa..569eec435 100644 --- a/frontend/app/duck/search.js +++ b/frontend/app/duck/search.js @@ -5,16 +5,18 @@ import { array, success, createListUpdater, mergeReducers } from './funcTools/to import Filter from 'Types/filter'; import SavedFilter from 'Types/filter/savedFilter'; import { errors as errorsRoute, isRoute } from 'App/routes'; -import { fetchList as fetchSessionList } from './sessions'; +import { fetchList as fetchSessionList, fetchAutoplayList } from './sessions'; import { fetchList as fetchErrorsList } from './errors'; import { FilterCategory, FilterKey } from 'Types/filter/filterType'; import { filtersMap, liveFiltersMap, generateFilterOptions } from 'Types/filter/newFilter'; import { DURATION_FILTER } from 'App/constants/storageKeys'; +import Period, { CUSTOM_RANGE } from 'Types/app/period'; const ERRORS_ROUTE = errorsRoute(); const name = 'search'; const idKey = 'searchId'; +const PER_PAGE = 10; const FETCH_LIST = fetchListType(name); const FETCH_FILTER_SEARCH = fetchListType(`${name}/FILTER_SEARCH`); @@ -33,25 +35,30 @@ const SET_ACTIVE_TAB = `${name}/SET_ACTIVE_TAB`; const SET_SCROLL_POSITION = `${name}/SET_SCROLL_POSITION`; const REFRESH_FILTER_OPTIONS = 'filters/REFRESH_FILTER_OPTIONS'; +const CHECK_LATEST = fetchListType(`${name}/CHECK_LATEST`); +const UPDATE_LATEST_REQUEST_TIME = 'filters/UPDATE_LATEST_REQUEST_TIME' -function chartWrapper(chart = []) { - return chart.map((point) => ({ ...point, count: Math.max(point.count, 0) })); -} +// function chartWrapper(chart = []) { +// return chart.map((point) => ({ ...point, count: Math.max(point.count, 0) })); +// } -const savedSearchIdKey = 'searchId'; -const updateItemInList = createListUpdater(savedSearchIdKey); -const updateInstance = (state, instance) => - state.getIn(['savedSearch', savedSearchIdKey]) === instance[savedSearchIdKey] ? state.mergeIn(['savedSearch'], SavedFilter(instance)) : state; +// const savedSearchIdKey = 'searchId'; +// const updateItemInList = createListUpdater(savedSearchIdKey); +// const updateInstance = (state, instance) => +// state.getIn(['savedSearch', savedSearchIdKey]) === instance[savedSearchIdKey] ? state.mergeIn(['savedSearch'], SavedFilter(instance)) : state; const initialState = Map({ filterList: generateFilterOptions(filtersMap), filterListLive: generateFilterOptions(liveFiltersMap), list: List(), + latestRequestTime: null, + latestList: List(), alertMetricId: null, instance: new Filter({ filters: [] }), savedSearch: new SavedFilter({}), filterSearchList: {}, currentPage: 1, + pageSize: PER_PAGE, activeTab: { name: 'All', type: 'all' }, scrollY: 0, }); @@ -73,6 +80,10 @@ function reducer(state = initialState, action = {}) { 'list', List(data.map(SavedFilter)).sortBy((i) => i.searchId) ); + case UPDATE_LATEST_REQUEST_TIME: + return state.set('latestRequestTime', Date.now()).set('latestList', []) + case success(CHECK_LATEST): + return state.set('latestList', action.data) case success(FETCH_FILTER_SEARCH): const groupedList = action.data.reduce((acc, item) => { const { projectId, type, value } = item; @@ -131,52 +142,69 @@ export const filterMap = ({ category, value, key, operator, sourceOperator, sour filters: filters ? filters.map(filterMap) : [], }); + +const getFilters = (state) => { + const filter = state.getIn(['search', 'instance']).toData(); + const activeTab = state.getIn(['search', 'activeTab']); + if (activeTab.type !== 'all' && activeTab.type !== 'bookmark' && activeTab.type !== 'vault') { + const tmpFilter = filtersMap[FilterKey.ISSUE]; + tmpFilter.value = [activeTab.type]; + filter.filters = filter.filters.concat(tmpFilter); + } + + if (activeTab.type === 'bookmark' || activeTab.type === 'vault') { + filter.bookmarked = true; + } + + filter.filters = filter.filters.map(filterMap); + + // duration filter from local storage + if (!filter.filters.find((f) => f.type === FilterKey.DURATION)) { + const durationFilter = JSON.parse(localStorage.getItem(DURATION_FILTER) || '{"count": 0}'); + let durationValue = parseInt(durationFilter.count); + if (durationValue > 0) { + const value = [0]; + durationValue = durationFilter.countType === 'min' ? durationValue * 60 * 1000 : durationValue * 1000; + if (durationFilter.operator === '<') { + value[0] = durationValue; + } else if (durationFilter.operator === '>') { + value[1] = durationValue; + } + + filter.filters = filter.filters.concat({ + type: FilterKey.DURATION, + operator: 'is', + value, + }); + } + } + + return filter; +} + export const reduceThenFetchResource = (actionCreator) => (...args) => (dispatch, getState) => { dispatch(actionCreator(...args)); - const filter = getState().getIn(['search', 'instance']).toData(); - const activeTab = getState().getIn(['search', 'activeTab']); - if (activeTab.type === 'notes') return; - if (activeTab.type !== 'all' && activeTab.type !== 'bookmark' && activeTab.type !== 'vault') { - const tmpFilter = filtersMap[FilterKey.ISSUE]; - tmpFilter.value = [activeTab.type]; - filter.filters = filter.filters.concat(tmpFilter); - } - - if (activeTab.type === 'bookmark' || activeTab.type === 'vault') { - filter.bookmarked = true; - } - - filter.filters = filter.filters.map(filterMap); - filter.limit = 10; + + const filter = getFilters(getState()); + filter.limit = PER_PAGE; filter.page = getState().getIn(['search', 'currentPage']); + const forceFetch = filter.filters.length === 0 || args[1] === true; - // duration filter from local storage - if (!filter.filters.find((f) => f.type === FilterKey.DURATION)) { - const durationFilter = JSON.parse(localStorage.getItem(DURATION_FILTER) || '{"count": 0}'); - let durationValue = parseInt(durationFilter.count); - if (durationValue > 0) { - const value = [0]; - durationValue = durationFilter.countType === 'min' ? durationValue * 60 * 1000 : durationValue * 1000; - if (durationFilter.operator === '<') { - value[0] = durationValue; - } else if (durationFilter.operator === '>') { - value[1] = durationValue; - } - - filter.filters = filter.filters.concat({ - type: FilterKey.DURATION, - operator: 'is', - value, - }); - } + // reset the timestamps to latest + if (filter.rangeValue !== CUSTOM_RANGE) { + const period = new Period({ rangeName: filter.rangeValue }) + const newTimestamps = period.toJSON(); + filter.startDate = newTimestamps.startDate + filter.endDate = newTimestamps.endDate } + dispatch(updateLatestRequestTime()) return isRoute(ERRORS_ROUTE, window.location.pathname) ? dispatch(fetchErrorsList(filter)) : dispatch(fetchSessionList(filter, forceFetch)); }; @@ -353,3 +381,33 @@ export const setScrollPosition = (scrollPosition) => { scrollPosition, }; }; + +export const updateLatestRequestTime = () => { + return { + type: UPDATE_LATEST_REQUEST_TIME + } +} + +export const checkForLatestSessions = () => (dispatch, getState) => { + const state = getState(); + const filter = getFilters(state); + const latestRequestTime = state.getIn(['search', 'latestRequestTime']) + if (!!latestRequestTime) { + const period = new Period({ rangeName: CUSTOM_RANGE, start: latestRequestTime, end: Date.now() }) + const newTimestamps = period.toJSON(); + filter.startDate = newTimestamps.startDate + filter.endDate = newTimestamps.endDate + } + + return dispatch({ + types: array(CHECK_LATEST), + call: (client) => client.post(`/sessions/search/ids`, filter), + }); +} + +export const fetchAutoplaySessions = (page) => (dispatch, getState) => { + const filter = getFilters(getState()); + filter.page = page; + filter.limit = PER_PAGE; + return dispatch(fetchAutoplayList(filter)); +} \ No newline at end of file diff --git a/frontend/app/duck/sessions.js b/frontend/app/duck/sessions.js index 8213a6b57..ecce3d713 100644 --- a/frontend/app/duck/sessions.js +++ b/frontend/app/duck/sessions.js @@ -11,6 +11,7 @@ import { getDateRangeFromValue } from 'App/dateRange'; const name = 'sessions'; const INIT = 'sessions/INIT'; const FETCH_LIST = new RequestTypes('sessions/FETCH_LIST'); +const FETCH_AUTOPLAY_LIST = new RequestTypes('sessions/FETCH_AUTOPLAY_LIST'); const FETCH = new RequestTypes('sessions/FETCH'); const FETCH_FAVORITE_LIST = new RequestTypes('sessions/FETCH_FAVORITE_LIST'); const FETCH_LIVE_LIST = new RequestTypes('sessions/FETCH_LIVE_LIST'); @@ -96,6 +97,10 @@ const reducer = (state = initialState, action = {}) => { list.filter(({ favorite }) => favorite) ) .set('total', total); + case FETCH_AUTOPLAY_LIST.SUCCESS: + let sessionIds = state.get('sessionIds'); + sessionIds = sessionIds.concat(action.data.map(i => i.sessionId + '')) + return state.set('sessionIds', sessionIds.filter((i, index) => sessionIds.indexOf(i) === index )) case SET_AUTOPLAY_VALUES: { const sessionIds = state.get('sessionIds'); const currentSessionId = state.get('current').sessionId; @@ -257,7 +262,7 @@ function init(session) { export const fetchList = (params = {}, force = false) => - (dispatch, getState) => { + (dispatch) => { if (!force) { // compare with the last fetched filter const oldFilters = getSessionFilter(); if (compareJsonObjects(oldFilters, cleanSessionFilters(params))) { @@ -273,6 +278,19 @@ export const fetchList = }); }; +export const fetchAutoplayList = + (params = {}) => + (dispatch) => { + setSessionFilter(cleanSessionFilters(params)); + return dispatch({ + types: FETCH_AUTOPLAY_LIST.toArray(), + call: (client) => client.post('/sessions/search/ids', params), + params: cleanParams(params), + }); + }; + + + export function fetchErrorStackList(sessionId, errorId) { return { types: FETCH_ERROR_STACK.toArray(), @@ -436,4 +454,4 @@ export function updateLastPlayedSession(sessionId) { type: LAST_PLAYED_SESSION_ID, sessionId, }; -} +} \ No newline at end of file