From 337a4dc45ffccc69c5ccd6d9e414f8c17e8fa6b5 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Thu, 6 Apr 2023 12:27:44 +0200 Subject: [PATCH 1/2] change(player): clear redux state on unmount --- frontend/app/components/Session/LivePlayer.tsx | 6 ++---- frontend/app/components/Session/LiveSession.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Session/LivePlayer.tsx b/frontend/app/components/Session/LivePlayer.tsx index 5cc27b51f..060ff1b8f 100644 --- a/frontend/app/components/Session/LivePlayer.tsx +++ b/frontend/app/components/Session/LivePlayer.tsx @@ -44,6 +44,7 @@ function LivePlayer({ useEffect(() => { if (!usedSession.sessionId || contextValue.player !== undefined) return; + console.debug('creating live player for', usedSession.sessionId) const sessionWithAgentData = { ...usedSession, agentInfo: { @@ -67,10 +68,7 @@ function LivePlayer({ setContextValue({ player, store }); playerInst = player; } - }, [usedSession.sessionId]); - // not cleaning up in multiview - useEffect(() => { return () => { if (!location.pathname.includes('multiview') || !location.pathname.includes(usedSession.sessionId)) { playerInst?.clean?.(); @@ -78,7 +76,7 @@ function LivePlayer({ setContextValue(defaultContextValue) } } - }, [location.pathname]) + }, [location.pathname]); // LAYOUT (TODO: local layout state - useContext or something..) useEffect(() => { diff --git a/frontend/app/components/Session/LiveSession.js b/frontend/app/components/Session/LiveSession.js index b47527a8d..f7cc625d5 100644 --- a/frontend/app/components/Session/LiveSession.js +++ b/frontend/app/components/Session/LiveSession.js @@ -2,7 +2,7 @@ import React from 'react'; import { useEffect } from 'react'; import { connect } from 'react-redux'; import usePageTitle from 'App/hooks/usePageTitle'; -import { fetch as fetchSession } from 'Duck/sessions'; +import { fetch as fetchSession, clearCurrentSession } from 'Duck/sessions'; import { fetchList as fetchSlackList } from 'Duck/integrations/slack'; import { Loader } from 'UI'; import withPermissions from 'HOCs/withPermissions'; @@ -17,6 +17,7 @@ function LiveSession({ hasSessionsPath, session, fetchFailed, + clearCurrentSession, }) { const [initialLoading, setInitialLoading] = React.useState(true); usePageTitle('OpenReplay Assist'); @@ -24,6 +25,10 @@ function LiveSession({ useEffect(() => { clearLogs(); fetchSlackList(); + + return () => { + clearCurrentSession() + }; }, []); useEffect(() => { @@ -46,7 +51,7 @@ function LiveSession({ return ( - + {session.sessionId && } ); } @@ -77,6 +82,7 @@ export default withPermissions( { fetchSession, fetchSlackList, + clearCurrentSession, } )(LiveSession) ); From efb8ed4b5672194b72d6870bf5a39309b1a3609e Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Thu, 6 Apr 2023 12:33:47 +0200 Subject: [PATCH 2/2] Fix: chalice healthcheck namespace customization (#1118) (#1120) * chore(helm): Adding redis, kafka string env * chore(chalice): Update health check endpoints Fixes #1113 --------- Signed-off-by: rjshrjndrn --- api/chalicelib/core/health.py | 39 +++++++++++------- ee/api/chalicelib/core/health.py | 40 ++++++++++++------- .../charts/chalice/templates/deployment.yaml | 8 ++++ 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/api/chalicelib/core/health.py b/api/chalicelib/core/health.py index 76fcf35ca..c7e67734d 100644 --- a/api/chalicelib/core/health.py +++ b/api/chalicelib/core/health.py @@ -6,21 +6,32 @@ from decouple import config from chalicelib.utils import pg_client + +def app_connection_string(name, port, path): + namespace = config("POD_NAMESPACE", default="app") + conn_string = config("CLUSTER_URL", default="svc.cluster.local") + return ( + "http://" + name + "." + namespace + "." + conn_string + ":" + port + "/" + path + ) + + HEALTH_ENDPOINTS = { - "alerts": "http://alerts-openreplay.app.svc.cluster.local:8888/health", - "assets": "http://assets-openreplay.app.svc.cluster.local:8888/metrics", - "assist": "http://assist-openreplay.app.svc.cluster.local:8888/health", - "chalice": "http://chalice-openreplay.app.svc.cluster.local:8888/metrics", - "db": "http://db-openreplay.app.svc.cluster.local:8888/metrics", - "ender": "http://ender-openreplay.app.svc.cluster.local:8888/metrics", - "heuristics": "http://heuristics-openreplay.app.svc.cluster.local:8888/metrics", - "http": "http://http-openreplay.app.svc.cluster.local:8888/metrics", - "ingress-nginx": "http://ingress-nginx-openreplay.app.svc.cluster.local:8888/metrics", - "integrations": "http://integrations-openreplay.app.svc.cluster.local:8888/metrics", - "peers": "http://peers-openreplay.app.svc.cluster.local:8888/health", - "sink": "http://sink-openreplay.app.svc.cluster.local:8888/metrics", - "sourcemaps-reader": "http://sourcemapreader-openreplay.app.svc.cluster.local:8888/health", - "storage": "http://storage-openreplay.app.svc.cluster.local:8888/metrics", + "alerts": app_connection_string("alerts-openreplay", 8888, "metrics"), + "assets": app_connection_string("assets-openreplay", 8888, "metrics"), + "assist": app_connection_string("assist-openreplay", 8888, "metrics"), + "chalice": app_connection_string("chalice-openreplay", 8888, "metrics"), + "db": app_connection_string("db-openreplay", 8888, "metrics"), + "ender": app_connection_string("ender-openreplay", 8888, "metrics"), + "heuristics": app_connection_string("heuristics-openreplay", 8888, "metrics"), + "http": app_connection_string("http-openreplay", 8888, "metrics"), + "ingress-nginx": app_connection_string("ingress-nginx-openreplay", 80, "healthz"), + "integrations": app_connection_string("integrations-openreplay", 8888, "metrics"), + "peers": app_connection_string("peers-openreplay", 8888, "health"), + "sink": app_connection_string("sink-openreplay", 8888, "metrics"), + "sourcemaps-reader": app_connection_string( + "sourcemapreader-openreplay", 8888, "health" + ), + "storage": app_connection_string("storage-openreplay", 8888, "metrics"), } diff --git a/ee/api/chalicelib/core/health.py b/ee/api/chalicelib/core/health.py index 1daf00c2b..b1cd6ad58 100644 --- a/ee/api/chalicelib/core/health.py +++ b/ee/api/chalicelib/core/health.py @@ -7,22 +7,32 @@ from decouple import config from chalicelib.utils import pg_client, ch_client + +def app_connection_string(name, port, path): + namespace = config("POD_NAMESPACE", default="app") + conn_string = config("CLUSTER_URL", default="svc.cluster.local") + return ( + "http://" + name + "." + namespace + "." + conn_string + ":" + port + "/" + path + ) + + HEALTH_ENDPOINTS = { - "alerts": "http://alerts-openreplay.app.svc.cluster.local:8888/health", - "assets": "http://assets-openreplay.app.svc.cluster.local:8888/metrics", - "assist": "http://assist-openreplay.app.svc.cluster.local:8888/health", - "chalice": "http://chalice-openreplay.app.svc.cluster.local:8888/metrics", - "db": "http://db-openreplay.app.svc.cluster.local:8888/metrics", - "ender": "http://ender-openreplay.app.svc.cluster.local:8888/metrics", - "heuristics": "http://heuristics-openreplay.app.svc.cluster.local:8888/metrics", - "http": "http://http-openreplay.app.svc.cluster.local:8888/metrics", - "ingress-nginx": "http://ingress-nginx-openreplay.app.svc.cluster.local:8888/metrics", - "integrations": "http://integrations-openreplay.app.svc.cluster.local:8888/metrics", - "peers": "http://peers-openreplay.app.svc.cluster.local:8888/health", - "quickwit": "http://quickwit-openreplay.app.svc.cluster.local:8888/metrics", - "sink": "http://sink-openreplay.app.svc.cluster.local:8888/metrics", - "sourcemaps-reader": "http://sourcemapreader-openreplay.app.svc.cluster.local:8888/health", - "storage": "http://storage-openreplay.app.svc.cluster.local:8888/metrics", + "alerts": app_connection_string("alerts-openreplay", 8888, "metrics"), + "assets": app_connection_string("assets-openreplay", 8888, "metrics"), + "assist": app_connection_string("assist-openreplay", 8888, "metrics"), + "chalice": app_connection_string("chalice-openreplay", 8888, "metrics"), + "db": app_connection_string("db-openreplay", 8888, "metrics"), + "ender": app_connection_string("ender-openreplay", 8888, "metrics"), + "heuristics": app_connection_string("heuristics-openreplay", 8888, "metrics"), + "http": app_connection_string("http-openreplay", 8888, "metrics"), + "ingress-nginx": app_connection_string("ingress-nginx-openreplay", 80, "healthz"), + "integrations": app_connection_string("integrations-openreplay", 8888, "metrics"), + "peers": app_connection_string("peers-openreplay", 8888, "health"), + "sink": app_connection_string("sink-openreplay", 8888, "metrics"), + "sourcemaps-reader": app_connection_string( + "sourcemapreader-openreplay", 8888, "health" + ), + "storage": app_connection_string("storage-openreplay", 8888, "metrics"), } diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index eaaab92c5..1efa5bccf 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -43,6 +43,10 @@ spec: {{- .Values.healthCheck | toYaml | nindent 10}} {{- end}} env: + - name: KAFKA_SERVERS + value: "{{ .Values.global.kafka.kafkaHost }}" + - name: REDIS_STRING + value: "{{ .Values.global.redis.redisHost }}" - name: ch_username value: "{{ .Values.global.clickhouse.username }}" - name: ch_password @@ -142,6 +146,10 @@ spec: - name: {{ $key }} value: '{{ $val }}' {{- end}} + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace ports: {{- range $key, $val := .Values.service.ports }} - name: {{ $key }}