From 918ddcae5d51ffbdb2f11b380c24044b18e3dc1f Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 2 Sep 2022 16:38:09 +0100 Subject: [PATCH 1/5] feat(chalice): fixed jira integration --- api/chalicelib/core/integration_jira_cloud.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api/chalicelib/core/integration_jira_cloud.py b/api/chalicelib/core/integration_jira_cloud.py index 656a22b14..03d75f1e4 100644 --- a/api/chalicelib/core/integration_jira_cloud.py +++ b/api/chalicelib/core/integration_jira_cloud.py @@ -15,6 +15,7 @@ class JIRAIntegration(integration_base.BaseIntegration): self.__tenant_id = tenant_id # TODO: enable super-constructor when OAuth is done # super(JIRAIntegration, self).__init__(jwt, user_id, JIRACloudIntegrationProxy) + self._issue_handler = None self._user_id = user_id self.integration = self.get() @@ -30,15 +31,15 @@ class JIRAIntegration(integration_base.BaseIntegration): @property def issue_handler(self): - if self.integration["url"].endswith('atlassian.net') and self.__issue_handler is None: + if self.integration["url"].endswith('atlassian.net') and self._issue_handler is None: try: - self.__issue_handler = JIRACloudIntegrationIssue(token=self.integration["token"], - username=self.integration["username"], - url=self.integration["url"]) + self._issue_handler = JIRACloudIntegrationIssue(token=self.integration["token"], + username=self.integration["username"], + url=self.integration["url"]) except Exception as e: - self.__issue_handler = None + self._issue_handler = None self.integration["valid"] = False - return self.__issue_handler + return self._issue_handler # TODO: remove this once jira-oauth is done def get(self): From c526d611f57f0e8c625e2416699267f3b5555171 Mon Sep 17 00:00:00 2001 From: Alexander Zavorotynskiy Date: Fri, 2 Sep 2022 18:16:10 +0200 Subject: [PATCH 2/5] fix(backend): fixed some issues in db service --- backend/pkg/db/postgres/messages-web.go | 1 - backend/pkg/db/postgres/session.go | 9 ++++++--- ee/backend/pkg/db/clickhouse/connector.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/pkg/db/postgres/messages-web.go b/backend/pkg/db/postgres/messages-web.go index a130be2cc..9758587b8 100644 --- a/backend/pkg/db/postgres/messages-web.go +++ b/backend/pkg/db/postgres/messages-web.go @@ -189,7 +189,6 @@ func (conn *Conn) InsertWebGraphQLEvent(sessionID uint64, projectID uint32, save } func (conn *Conn) InsertSessionReferrer(sessionID uint64, referrer string) error { - log.Printf("insert referrer, sessID: %d, referrer: %s", sessionID, referrer) if referrer == "" { return nil } diff --git a/backend/pkg/db/postgres/session.go b/backend/pkg/db/postgres/session.go index 08145b567..c402ed703 100644 --- a/backend/pkg/db/postgres/session.go +++ b/backend/pkg/db/postgres/session.go @@ -8,7 +8,7 @@ import ( func (conn *Conn) GetSession(sessionID uint64) (*Session, error) { s := &Session{SessionID: sessionID} - var revID, userOSVersion *string + var revID, userOSVersion, userBrowserVersion *string var issueTypes pgtype.EnumArray if err := conn.c.QueryRow(` SELECT platform, @@ -32,14 +32,17 @@ func (conn *Conn) GetSession(sessionID uint64) (*Session, error) { &revID, &s.TrackerVersion, &s.UserID, &s.UserAnonymousID, &s.Referrer, &s.PagesCount, &s.EventsCount, &s.ErrorsCount, &issueTypes, - &s.UserBrowser, &s.UserBrowserVersion, &s.IssueScore, + &s.UserBrowser, &userBrowserVersion, &s.IssueScore, &s.Metadata1, &s.Metadata2, &s.Metadata3, &s.Metadata4, &s.Metadata5, &s.Metadata6, &s.Metadata7, &s.Metadata8, &s.Metadata9, &s.Metadata10); err != nil { return nil, err } - if userOSVersion != nil { // TODO: choose format, make f + if userOSVersion != nil { s.UserOSVersion = *userOSVersion } + if userBrowserVersion != nil { + s.UserBrowserVersion = *userBrowserVersion + } if revID != nil { s.RevID = *revID } diff --git a/ee/backend/pkg/db/clickhouse/connector.go b/ee/backend/pkg/db/clickhouse/connector.go index dcf603055..8d66e5190 100644 --- a/ee/backend/pkg/db/clickhouse/connector.go +++ b/ee/backend/pkg/db/clickhouse/connector.go @@ -324,7 +324,7 @@ func (c *connectorImpl) InsertWebPerformanceTrackAggr(session *types.Session, ms if err := c.batches["performance"].Append( session.SessionID, uint16(session.ProjectID), - 0, // TODO: find messageID for performance events + uint64(0), // TODO: find messageID for performance events datetime(timestamp), nullableString(msg.Meta().Url), uint8(msg.MinFPS), From b275d11e29163983773bce9b45029af30c464346 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 2 Sep 2022 17:46:00 +0100 Subject: [PATCH 3/5] feat(assist): catch error event --- ee/utilities/servers/websocket-cluster.js | 1 + ee/utilities/servers/websocket.js | 1 + utilities/servers/websocket.js | 1 + utilities/utils/assistHelper.js | 7 ++++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ee/utilities/servers/websocket-cluster.js b/ee/utilities/servers/websocket-cluster.js index 734dbfb4e..4f310468a 100644 --- a/ee/utilities/servers/websocket-cluster.js +++ b/ee/utilities/servers/websocket-cluster.js @@ -351,6 +351,7 @@ module.exports = { socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err)); socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err)); + socket.on(EVENTS_DEFINITION.listen.ERROR, err => errorHandler(EVENTS_DEFINITION.listen.ERROR, err)); socket.onAny(async (eventName, ...args) => { if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) { diff --git a/ee/utilities/servers/websocket.js b/ee/utilities/servers/websocket.js index 782f70348..224f44490 100644 --- a/ee/utilities/servers/websocket.js +++ b/ee/utilities/servers/websocket.js @@ -327,6 +327,7 @@ module.exports = { socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err)); socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err)); + socket.on(EVENTS_DEFINITION.listen.ERROR, err => errorHandler(EVENTS_DEFINITION.listen.ERROR, err)); socket.onAny(async (eventName, ...args) => { if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) { diff --git a/utilities/servers/websocket.js b/utilities/servers/websocket.js index ac8866fbb..70c472e67 100644 --- a/utilities/servers/websocket.js +++ b/utilities/servers/websocket.js @@ -308,6 +308,7 @@ module.exports = { socket.on(EVENTS_DEFINITION.listen.CONNECT_ERROR, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_ERROR, err)); socket.on(EVENTS_DEFINITION.listen.CONNECT_FAILED, err => errorHandler(EVENTS_DEFINITION.listen.CONNECT_FAILED, err)); + socket.on(EVENTS_DEFINITION.listen.ERROR, err => errorHandler(EVENTS_DEFINITION.listen.ERROR, err)); socket.onAny(async (eventName, ...args) => { if (Object.values(EVENTS_DEFINITION.listen).indexOf(eventName) >= 0) { diff --git a/utilities/utils/assistHelper.js b/utilities/utils/assistHelper.js index ed4d083ec..212a3b93d 100644 --- a/utilities/utils/assistHelper.js +++ b/utilities/utils/assistHelper.js @@ -4,7 +4,12 @@ const {geoip} = require('./geoIP'); let debug = process.env.debug === "1" || false; const IDENTITIES = {agent: 'agent', session: 'session'}; const EVENTS_DEFINITION = { - listen: {UPDATE_EVENT: "UPDATE_SESSION", CONNECT_ERROR: "connect_error", CONNECT_FAILED: "connect_failed"} + listen: { + UPDATE_EVENT: "UPDATE_SESSION", + CONNECT_ERROR: "connect_error", + CONNECT_FAILED: "connect_failed", + ERROR: "error" + } }; EVENTS_DEFINITION.emit = { NEW_AGENT: "NEW_AGENT", From c3547174e5e064d87ba673c22ee8d30c5bd9f991 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 2 Sep 2022 20:20:30 +0100 Subject: [PATCH 4/5] feat(chalice): fixed github integration --- api/chalicelib/core/integration_github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/chalicelib/core/integration_github.py b/api/chalicelib/core/integration_github.py index 31e715f4a..0190cfbc5 100644 --- a/api/chalicelib/core/integration_github.py +++ b/api/chalicelib/core/integration_github.py @@ -18,7 +18,7 @@ class GitHubIntegration(integration_base.BaseIntegration): @property def issue_handler(self): - return + return self.__issue_handler def get_obfuscated(self): integration = self.get() From ee4ebd838f87d9f253e82fd4670cb913e6acb2b0 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 2 Sep 2022 20:26:06 +0100 Subject: [PATCH 5/5] feat(chalice): fixed github integration --- api/chalicelib/core/integration_base.py | 2 +- api/chalicelib/core/integration_github.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/chalicelib/core/integration_base.py b/api/chalicelib/core/integration_base.py index 6377599af..f03d96672 100644 --- a/api/chalicelib/core/integration_base.py +++ b/api/chalicelib/core/integration_base.py @@ -7,7 +7,7 @@ class BaseIntegration(ABC): def __init__(self, user_id, ISSUE_CLASS): self._user_id = user_id - self.__issue_handler = ISSUE_CLASS(self.integration_token) + self._issue_handler = ISSUE_CLASS(self.integration_token) @property @abstractmethod diff --git a/api/chalicelib/core/integration_github.py b/api/chalicelib/core/integration_github.py index 0190cfbc5..b300aa7f7 100644 --- a/api/chalicelib/core/integration_github.py +++ b/api/chalicelib/core/integration_github.py @@ -18,7 +18,7 @@ class GitHubIntegration(integration_base.BaseIntegration): @property def issue_handler(self): - return self.__issue_handler + return self._issue_handler def get_obfuscated(self): integration = self.get()