Merge branch 'dev' into live-se-red
This commit is contained in:
commit
c1283c7f20
88 changed files with 729 additions and 8136 deletions
|
|
@ -1,10 +0,0 @@
|
|||
from decouple import config
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
|
||||
if config("EXP_AUTOCOMPLETE", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental autocomplete")
|
||||
from . import autocomplete_exp as autocomplete
|
||||
else:
|
||||
from . import autocomplete as autocomplete
|
||||
|
|
@ -7,8 +7,8 @@ from decouple import config
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import notifications, webhook
|
||||
from chalicelib.core.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaboration_slack import Slack
|
||||
from chalicelib.core.collaborations.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaborations.collaboration_slack import Slack
|
||||
from chalicelib.utils import pg_client, helper, email_helper, smtp
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
from chalicelib.core.alerts.modules import TENANT_ID
|
||||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
|
||||
def get_all_alerts():
|
||||
with pg_client.PostgresClient(long_query=True) as cur:
|
||||
query = """SELECT -1 AS tenant_id,
|
||||
query = f"""SELECT {TENANT_ID} AS tenant_id,
|
||||
alert_id,
|
||||
projects.project_id,
|
||||
projects.name AS project_name,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import decimal
|
||||
import logging
|
||||
|
||||
from pydantic_core._pydantic_core import ValidationError
|
||||
|
||||
import schemas
|
||||
from chalicelib.core.alerts import alerts
|
||||
from chalicelib.core.alerts import alerts_listener
|
||||
from chalicelib.core.alerts import sessions
|
||||
from chalicelib.core.alerts import alerts, alerts_listener
|
||||
from chalicelib.core.alerts.modules import sessions, alert_helpers
|
||||
from chalicelib.utils import pg_client
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
|
|
@ -47,35 +45,6 @@ LeftToDb = {
|
|||
"formula": "COUNT(DISTINCT session_id)", "condition": "source!='js_exception'", "joinSessions": False},
|
||||
}
|
||||
|
||||
# This is the frequency of execution for each threshold
|
||||
TimeInterval = {
|
||||
15: 3,
|
||||
30: 5,
|
||||
60: 10,
|
||||
120: 20,
|
||||
240: 30,
|
||||
1440: 60,
|
||||
}
|
||||
|
||||
|
||||
def can_check(a) -> bool:
|
||||
now = TimeUTC.now()
|
||||
|
||||
repetitionBase = a["options"]["currentPeriod"] \
|
||||
if a["detectionMethod"] == schemas.AlertDetectionMethod.CHANGE \
|
||||
and a["options"]["currentPeriod"] > a["options"]["previousPeriod"] \
|
||||
else a["options"]["previousPeriod"]
|
||||
|
||||
if TimeInterval.get(repetitionBase) is None:
|
||||
logger.error(f"repetitionBase: {repetitionBase} NOT FOUND")
|
||||
return False
|
||||
|
||||
return (a["options"]["renotifyInterval"] <= 0 or
|
||||
a["options"].get("lastNotification") is None or
|
||||
a["options"]["lastNotification"] <= 0 or
|
||||
((now - a["options"]["lastNotification"]) > a["options"]["renotifyInterval"] * 60 * 1000)) \
|
||||
and ((now - a["createdAt"]) % (TimeInterval[repetitionBase] * 60 * 1000)) < 60 * 1000
|
||||
|
||||
|
||||
def Build(a):
|
||||
now = TimeUTC.now()
|
||||
|
|
@ -166,7 +135,7 @@ def process():
|
|||
all_alerts = alerts_listener.get_all_alerts()
|
||||
with pg_client.PostgresClient() as cur:
|
||||
for alert in all_alerts:
|
||||
if can_check(alert):
|
||||
if alert_helpers.can_check(alert):
|
||||
query, params = Build(alert)
|
||||
try:
|
||||
query = cur.mogrify(query, params)
|
||||
|
|
@ -182,7 +151,7 @@ def process():
|
|||
result = cur.fetchone()
|
||||
if result["valid"]:
|
||||
logger.info(f"Valid alert, notifying users, alertId:{alert['alertId']} name: {alert['name']}")
|
||||
notifications.append(generate_notification(alert, result))
|
||||
notifications.append(alert_helpers.generate_notification(alert, result))
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"!!!Error while running alert query for alertId:{alert['alertId']} name: {alert['name']}")
|
||||
|
|
@ -196,42 +165,3 @@ def process():
|
|||
WHERE alert_id IN %(ids)s;""", {"ids": tuple([n["alertId"] for n in notifications])}))
|
||||
if len(notifications) > 0:
|
||||
alerts.process_notifications(notifications)
|
||||
|
||||
|
||||
def __format_value(x):
|
||||
if x % 1 == 0:
|
||||
x = int(x)
|
||||
else:
|
||||
x = round(x, 2)
|
||||
return f"{x:,}"
|
||||
|
||||
|
||||
def generate_notification(alert, result):
|
||||
left = __format_value(result['value'])
|
||||
right = __format_value(alert['query']['right'])
|
||||
return {
|
||||
"alertId": alert["alertId"],
|
||||
"tenantId": alert["tenantId"],
|
||||
"title": alert["name"],
|
||||
"description": f"{alert['seriesName']} = {left} ({alert['query']['operator']} {right}).",
|
||||
"buttonText": "Check metrics for more details",
|
||||
"buttonUrl": f"/{alert['projectId']}/metrics",
|
||||
"imageUrl": None,
|
||||
"projectId": alert["projectId"],
|
||||
"projectName": alert["projectName"],
|
||||
"options": {"source": "ALERT", "sourceId": alert["alertId"],
|
||||
"sourceMeta": alert["detectionMethod"],
|
||||
"message": alert["options"]["message"], "projectId": alert["projectId"],
|
||||
"data": {"title": alert["name"],
|
||||
"limitValue": alert["query"]["right"],
|
||||
"actualValue": float(result["value"]) \
|
||||
if isinstance(result["value"], decimal.Decimal) \
|
||||
else result["value"],
|
||||
"operator": alert["query"]["operator"],
|
||||
"trigger": alert["query"]["left"],
|
||||
"alertId": alert["alertId"],
|
||||
"detectionMethod": alert["detectionMethod"],
|
||||
"currentPeriod": alert["options"]["currentPeriod"],
|
||||
"previousPeriod": alert["options"]["previousPeriod"],
|
||||
"createdAt": TimeUTC.now()}},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@ import logging
|
|||
from pydantic_core._pydantic_core import ValidationError
|
||||
|
||||
import schemas
|
||||
from chalicelib.core.alerts import alerts
|
||||
from chalicelib.core.alerts import alerts_listener, alerts_processor
|
||||
from chalicelib.core.alerts import sessions
|
||||
from chalicelib.core.alerts import alerts, alerts_listener
|
||||
from chalicelib.core.alerts.modules import sessions, alert_helpers
|
||||
from chalicelib.utils import pg_client, ch_client, exp_ch_helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
|
|
@ -162,7 +161,7 @@ def process():
|
|||
for alert in all_alerts:
|
||||
if alert["query"]["left"] != "CUSTOM":
|
||||
continue
|
||||
if alerts_processor.can_check(alert):
|
||||
if alert_helpers.can_check(alert):
|
||||
query, params = Build(alert)
|
||||
try:
|
||||
query = ch_cur.format(query, params)
|
||||
|
|
@ -180,7 +179,7 @@ def process():
|
|||
|
||||
if result["valid"]:
|
||||
logger.info("Valid alert, notifying users")
|
||||
notifications.append(alerts_processor.generate_notification(alert, result))
|
||||
notifications.append(alert_helpers.generate_notification(alert, result))
|
||||
except Exception as e:
|
||||
logger.error(f"!!!Error while running alert query for alertId:{alert['alertId']}")
|
||||
logger.error(str(e))
|
||||
|
|
|
|||
9
api/chalicelib/core/alerts/modules/__init__.py
Normal file
9
api/chalicelib/core/alerts/modules/__init__.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from decouple import config
|
||||
|
||||
TENANT_ID = "-1"
|
||||
if config("EXP_ALERTS", cast=bool, default=False):
|
||||
from chalicelib.core.sessions import sessions_ch as sessions
|
||||
else:
|
||||
from chalicelib.core.sessions import sessions
|
||||
|
||||
from . import helpers as alert_helpers
|
||||
74
api/chalicelib/core/alerts/modules/helpers.py
Normal file
74
api/chalicelib/core/alerts/modules/helpers.py
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import decimal
|
||||
import logging
|
||||
|
||||
import schemas
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
# This is the frequency of execution for each threshold
|
||||
TimeInterval = {
|
||||
15: 3,
|
||||
30: 5,
|
||||
60: 10,
|
||||
120: 20,
|
||||
240: 30,
|
||||
1440: 60,
|
||||
}
|
||||
|
||||
|
||||
def __format_value(x):
|
||||
if x % 1 == 0:
|
||||
x = int(x)
|
||||
else:
|
||||
x = round(x, 2)
|
||||
return f"{x:,}"
|
||||
|
||||
|
||||
def can_check(a) -> bool:
|
||||
now = TimeUTC.now()
|
||||
|
||||
repetitionBase = a["options"]["currentPeriod"] \
|
||||
if a["detectionMethod"] == schemas.AlertDetectionMethod.CHANGE \
|
||||
and a["options"]["currentPeriod"] > a["options"]["previousPeriod"] \
|
||||
else a["options"]["previousPeriod"]
|
||||
|
||||
if TimeInterval.get(repetitionBase) is None:
|
||||
logger.error(f"repetitionBase: {repetitionBase} NOT FOUND")
|
||||
return False
|
||||
|
||||
return (a["options"]["renotifyInterval"] <= 0 or
|
||||
a["options"].get("lastNotification") is None or
|
||||
a["options"]["lastNotification"] <= 0 or
|
||||
((now - a["options"]["lastNotification"]) > a["options"]["renotifyInterval"] * 60 * 1000)) \
|
||||
and ((now - a["createdAt"]) % (TimeInterval[repetitionBase] * 60 * 1000)) < 60 * 1000
|
||||
|
||||
|
||||
def generate_notification(alert, result):
|
||||
left = __format_value(result['value'])
|
||||
right = __format_value(alert['query']['right'])
|
||||
return {
|
||||
"alertId": alert["alertId"],
|
||||
"tenantId": alert["tenantId"],
|
||||
"title": alert["name"],
|
||||
"description": f"{alert['seriesName']} = {left} ({alert['query']['operator']} {right}).",
|
||||
"buttonText": "Check metrics for more details",
|
||||
"buttonUrl": f"/{alert['projectId']}/metrics",
|
||||
"imageUrl": None,
|
||||
"projectId": alert["projectId"],
|
||||
"projectName": alert["projectName"],
|
||||
"options": {"source": "ALERT", "sourceId": alert["alertId"],
|
||||
"sourceMeta": alert["detectionMethod"],
|
||||
"message": alert["options"]["message"], "projectId": alert["projectId"],
|
||||
"data": {"title": alert["name"],
|
||||
"limitValue": alert["query"]["right"],
|
||||
"actualValue": float(result["value"]) \
|
||||
if isinstance(result["value"], decimal.Decimal) \
|
||||
else result["value"],
|
||||
"operator": alert["query"]["operator"],
|
||||
"trigger": alert["query"]["left"],
|
||||
"alertId": alert["alertId"],
|
||||
"detectionMethod": alert["detectionMethod"],
|
||||
"currentPeriod": alert["options"]["currentPeriod"],
|
||||
"previousPeriod": alert["options"]["previousPeriod"],
|
||||
"createdAt": TimeUTC.now()}},
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
from decouple import config
|
||||
|
||||
if config("EXP_ALERTS", cast=bool, default=False):
|
||||
from chalicelib.core.sessions_ch import *
|
||||
else:
|
||||
from chalicelib.core.sessions import *
|
||||
11
api/chalicelib/core/autocomplete/__init__.py
Normal file
11
api/chalicelib/core/autocomplete/__init__.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import logging
|
||||
|
||||
from decouple import config
|
||||
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
|
||||
if config("EXP_AUTOCOMPLETE", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental autocomplete")
|
||||
from . import autocomplete_ch as autocomplete
|
||||
else:
|
||||
from . import autocomplete
|
||||
|
|
@ -61,11 +61,11 @@ def __get_autocomplete_table(value, project_id):
|
|||
try:
|
||||
cur.execute(query)
|
||||
except Exception as err:
|
||||
print("--------- AUTOCOMPLETE SEARCH QUERY EXCEPTION -----------")
|
||||
print(query.decode('UTF-8'))
|
||||
print("--------- VALUE -----------")
|
||||
print(value)
|
||||
print("--------------------")
|
||||
logger.exception("--------- AUTOCOMPLETE SEARCH QUERY EXCEPTION -----------")
|
||||
logger.exception(query.decode('UTF-8'))
|
||||
logger.exception("--------- VALUE -----------")
|
||||
logger.exception(value)
|
||||
logger.exception("--------------------")
|
||||
raise err
|
||||
results = cur.fetchall()
|
||||
for r in results:
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import schemas
|
||||
from chalicelib.core import countries, events, metadata
|
||||
from chalicelib.utils import ch_client
|
||||
|
|
@ -5,6 +6,7 @@ from chalicelib.utils import helper, exp_ch_helper
|
|||
from chalicelib.utils.event_filter_definition import Event
|
||||
from chalicelib.utils.or_cache import CachedResponse
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
TABLE = "experimental.autocomplete"
|
||||
|
||||
|
||||
|
|
@ -59,13 +61,13 @@ def __get_autocomplete_table(value, project_id):
|
|||
try:
|
||||
results = cur.execute(query=query, params=params)
|
||||
except Exception as err:
|
||||
print("--------- CH AUTOCOMPLETE SEARCH QUERY EXCEPTION -----------")
|
||||
print(cur.format(query=query, params=params))
|
||||
print("--------- PARAMS -----------")
|
||||
print(params)
|
||||
print("--------- VALUE -----------")
|
||||
print(value)
|
||||
print("--------------------")
|
||||
logger.exception("--------- CH AUTOCOMPLETE SEARCH QUERY EXCEPTION -----------")
|
||||
logger.exception(cur.format(query=query, params=params))
|
||||
logger.exception("--------- PARAMS -----------")
|
||||
logger.exception(params)
|
||||
logger.exception("--------- VALUE -----------")
|
||||
logger.exception(value)
|
||||
logger.exception("--------------------")
|
||||
raise err
|
||||
for r in results:
|
||||
r["type"] = r.pop("_type")
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
from chalicelib.utils import pg_client
|
||||
from chalicelib.core import projects, log_tool_datadog, log_tool_stackdriver, log_tool_sentry
|
||||
from chalicelib.core import projects
|
||||
from chalicelib.core.log_tools import datadog, stackdriver, sentry
|
||||
|
||||
from chalicelib.core import users
|
||||
|
||||
|
|
@ -49,9 +50,9 @@ def get_state(tenant_id):
|
|||
"done": len(users.get_members(tenant_id=tenant_id)) > 1,
|
||||
"URL": "https://app.openreplay.com/client/manage-users"},
|
||||
{"task": "Integrations",
|
||||
"done": len(log_tool_datadog.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(log_tool_sentry.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(log_tool_stackdriver.get_all(tenant_id=tenant_id)) > 0,
|
||||
"done": len(datadog.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(sentry.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(stackdriver.get_all(tenant_id=tenant_id)) > 0,
|
||||
"URL": "https://docs.openreplay.com/integrations"}
|
||||
]
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ def get_state_manage_users(tenant_id):
|
|||
|
||||
def get_state_integrations(tenant_id):
|
||||
return {"task": "Integrations",
|
||||
"done": len(log_tool_datadog.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(log_tool_sentry.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(log_tool_stackdriver.get_all(tenant_id=tenant_id)) > 0,
|
||||
"done": len(datadog.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(sentry.get_all(tenant_id=tenant_id)) > 0 \
|
||||
or len(stackdriver.get_all(tenant_id=tenant_id)) > 0,
|
||||
"URL": "https://docs.openreplay.com/integrations"}
|
||||
|
|
|
|||
1
api/chalicelib/core/collaborations/__init__.py
Normal file
1
api/chalicelib/core/collaborations/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import collaboration_base as _
|
||||
|
|
@ -6,7 +6,7 @@ from fastapi import HTTPException, status
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import webhook
|
||||
from chalicelib.core.collaboration_base import BaseCollaboration
|
||||
from chalicelib.core.collaborations.collaboration_base import BaseCollaboration
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ from fastapi import HTTPException, status
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import webhook
|
||||
from chalicelib.core.collaboration_base import BaseCollaboration
|
||||
from chalicelib.core.collaborations.collaboration_base import BaseCollaboration
|
||||
|
||||
|
||||
class Slack(BaseCollaboration):
|
||||
|
|
@ -4,8 +4,8 @@ import logging
|
|||
from fastapi import HTTPException, status
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import sessions, funnels, errors, issues, heatmaps, product_analytics, \
|
||||
custom_metrics_predefined
|
||||
from chalicelib.core import funnels, errors, issues, heatmaps, product_analytics, custom_metrics_predefined
|
||||
from chalicelib.core.sessions import sessions
|
||||
from chalicelib.utils import helper, pg_client
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from typing import Optional
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import autocomplete
|
||||
from chalicelib.core.autocomplete import autocomplete
|
||||
from chalicelib.core import issues
|
||||
from chalicelib.core import sessions_metas
|
||||
from chalicelib.core.sessions import sessions_metas
|
||||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
from chalicelib.utils.event_filter_definition import SupportedFilter, Event
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import logging
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import sessions_mobs, sessions
|
||||
from chalicelib.core import sessions
|
||||
from chalicelib.core.sessions import sessions_mobs
|
||||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
|
||||
|
|
|
|||
0
api/chalicelib/core/issue_tracking/__init__.py
Normal file
0
api/chalicelib/core/issue_tracking/__init__.py
Normal file
|
|
@ -1,12 +1,12 @@
|
|||
import schemas
|
||||
from chalicelib.core import integration_base
|
||||
from chalicelib.core.integration_github_issue import GithubIntegrationIssue
|
||||
from chalicelib.core.issue_tracking import base
|
||||
from chalicelib.core.issue_tracking.github_issue import GithubIntegrationIssue
|
||||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
PROVIDER = schemas.IntegrationType.GITHUB
|
||||
|
||||
|
||||
class GitHubIntegration(integration_base.BaseIntegration):
|
||||
class GitHubIntegration(base.BaseIntegration):
|
||||
|
||||
def __init__(self, tenant_id, user_id):
|
||||
self.__tenant_id = tenant_id
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
from chalicelib.core.integration_base_issue import BaseIntegrationIssue
|
||||
from chalicelib.core.issue_tracking.base_issue import BaseIntegrationIssue
|
||||
from chalicelib.utils import github_client_v3
|
||||
from chalicelib.utils.github_client_v3 import github_formatters as formatter
|
||||
|
||||
|
||||
class GithubIntegrationIssue(BaseIntegrationIssue):
|
||||
def __init__(self, integration_token):
|
||||
self.__client = github_client_v3.githubV3Request(integration_token)
|
||||
super(GithubIntegrationIssue, self).__init__("GITHUB", integration_token)
|
||||
def __init__(self, token):
|
||||
self.__client = github_client_v3.githubV3Request(token)
|
||||
super(GithubIntegrationIssue, self).__init__("GITHUB", token)
|
||||
|
||||
def get_current_user(self):
|
||||
return formatter.user(self.__client.get("/user"))
|
||||
|
|
@ -28,9 +28,9 @@ class GithubIntegrationIssue(BaseIntegrationIssue):
|
|||
|
||||
return meta
|
||||
|
||||
def create_new_assignment(self, integration_project_id, title, description, assignee,
|
||||
def create_new_assignment(self, project_id, title, description, assignee,
|
||||
issue_type):
|
||||
repoId = integration_project_id
|
||||
repoId = project_id
|
||||
assignees = [assignee]
|
||||
labels = [str(issue_type)]
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ class GithubIntegrationIssue(BaseIntegrationIssue):
|
|||
def get_by_ids(self, saved_issues):
|
||||
results = []
|
||||
for i in saved_issues:
|
||||
results.append(self.get(integration_project_id=i["integrationProjectId"], assignment_id=i["id"]))
|
||||
results.append(self.get(project_id=i["integrationProjectId"], assignment_id=i["id"]))
|
||||
return {"issues": results}
|
||||
|
||||
def get(self, integration_project_id, assignment_id):
|
||||
repoId = integration_project_id
|
||||
def get(self, project_id, assignment_id):
|
||||
repoId = project_id
|
||||
issueNumber = assignment_id
|
||||
issue = self.__client.get(f"/repositories/{repoId}/issues/{issueNumber}")
|
||||
issue = formatter.issue(issue)
|
||||
|
|
@ -72,17 +72,17 @@ class GithubIntegrationIssue(BaseIntegrationIssue):
|
|||
self.__client.get(f"/repositories/{repoId}/issues/{issueNumber}/comments")]
|
||||
return issue
|
||||
|
||||
def comment(self, integration_project_id, assignment_id, comment):
|
||||
repoId = integration_project_id
|
||||
def comment(self, project_id, assignment_id, comment):
|
||||
repoId = project_id
|
||||
issueNumber = assignment_id
|
||||
commentCreated = self.__client.post(f"/repositories/{repoId}/issues/{issueNumber}/comments",
|
||||
body={"body": comment})
|
||||
return formatter.comment(commentCreated)
|
||||
|
||||
def get_metas(self, integration_project_id):
|
||||
def get_metas(self, project_id):
|
||||
current_user = self.get_current_user()
|
||||
try:
|
||||
users = self.__client.get(f"/repositories/{integration_project_id}/collaborators")
|
||||
users = self.__client.get(f"/repositories/{project_id}/collaborators")
|
||||
except Exception as e:
|
||||
users = []
|
||||
users = [formatter.user(u) for u in users]
|
||||
|
|
@ -92,7 +92,7 @@ class GithubIntegrationIssue(BaseIntegrationIssue):
|
|||
return {"provider": self.provider.lower(),
|
||||
'users': users,
|
||||
'issueTypes': [formatter.label(l) for l in
|
||||
self.__client.get(f"/repositories/{integration_project_id}/labels")]
|
||||
self.__client.get(f"/repositories/{project_id}/labels")]
|
||||
}
|
||||
|
||||
def get_projects(self):
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import schemas
|
||||
from chalicelib.core.issue_tracking.modules import TENANT_CONDITION
|
||||
from chalicelib.utils import pg_client
|
||||
|
||||
|
||||
|
|
@ -51,10 +52,10 @@ def get_global_integrations_status(tenant_id, user_id, project_id):
|
|||
AND provider='elasticsearch')) AS {schemas.IntegrationType.ELASTICSEARCH.value},
|
||||
EXISTS((SELECT 1
|
||||
FROM public.webhooks
|
||||
WHERE type='slack' AND deleted_at ISNULL)) AS {schemas.IntegrationType.SLACK.value},
|
||||
WHERE type='slack' AND deleted_at ISNULL AND {TENANT_CONDITION})) AS {schemas.IntegrationType.SLACK.value},
|
||||
EXISTS((SELECT 1
|
||||
FROM public.webhooks
|
||||
WHERE type='msteams' AND deleted_at ISNULL)) AS {schemas.IntegrationType.MS_TEAMS.value},
|
||||
WHERE type='msteams' AND deleted_at ISNULL AND {TENANT_CONDITION})) AS {schemas.IntegrationType.MS_TEAMS.value},
|
||||
EXISTS((SELECT 1
|
||||
FROM public.integrations
|
||||
WHERE project_id=%(project_id)s AND provider='dynatrace')) AS {schemas.IntegrationType.DYNATRACE.value};""",
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from chalicelib.core import integration_github, integration_jira_cloud
|
||||
from chalicelib.core.issue_tracking import github, jira_cloud
|
||||
from chalicelib.utils import pg_client
|
||||
|
||||
SUPPORTED_TOOLS = [integration_github.PROVIDER, integration_jira_cloud.PROVIDER]
|
||||
SUPPORTED_TOOLS = [github.PROVIDER, jira_cloud.PROVIDER]
|
||||
|
||||
|
||||
def get_available_integrations(user_id):
|
||||
|
|
@ -23,7 +23,7 @@ def get_available_integrations(user_id):
|
|||
|
||||
def __get_default_integration(user_id):
|
||||
current_integrations = get_available_integrations(user_id)
|
||||
return integration_github.PROVIDER if current_integrations["github"] else integration_jira_cloud.PROVIDER if \
|
||||
return github.PROVIDER if current_integrations["github"] else jira_cloud.PROVIDER if \
|
||||
current_integrations["jira"] else None
|
||||
|
||||
|
||||
|
|
@ -35,11 +35,11 @@ def get_integration(tenant_id, user_id, tool=None, for_delete=False):
|
|||
tool = tool.upper()
|
||||
if tool not in SUPPORTED_TOOLS:
|
||||
return {"errors": [f"issue tracking tool not supported yet, available: {SUPPORTED_TOOLS}"]}, None
|
||||
if tool == integration_jira_cloud.PROVIDER:
|
||||
integration = integration_jira_cloud.JIRAIntegration(tenant_id=tenant_id, user_id=user_id)
|
||||
if tool == jira_cloud.PROVIDER:
|
||||
integration = jira_cloud.JIRAIntegration(tenant_id=tenant_id, user_id=user_id)
|
||||
if not for_delete and integration.integration is not None and not integration.integration.get("valid", True):
|
||||
return {"errors": ["JIRA: connexion issue/unauthorized"]}, integration
|
||||
return None, integration
|
||||
elif tool == integration_github.PROVIDER:
|
||||
return None, integration_github.GitHubIntegration(tenant_id=tenant_id, user_id=user_id)
|
||||
elif tool == github.PROVIDER:
|
||||
return None, github.GitHubIntegration(tenant_id=tenant_id, user_id=user_id)
|
||||
return {"errors": ["lost integration"]}, None
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import schemas
|
||||
from chalicelib.core import integration_base
|
||||
from chalicelib.core.integration_jira_cloud_issue import JIRACloudIntegrationIssue
|
||||
from chalicelib.core.issue_tracking import base
|
||||
from chalicelib.core.issue_tracking.jira_cloud_issue import JIRACloudIntegrationIssue
|
||||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
PROVIDER = schemas.IntegrationType.JIRA
|
||||
|
|
@ -10,7 +10,7 @@ def obfuscate_string(string):
|
|||
return "*" * (len(string) - 4) + string[-4:]
|
||||
|
||||
|
||||
class JIRAIntegration(integration_base.BaseIntegration):
|
||||
class JIRAIntegration(base.BaseIntegration):
|
||||
def __init__(self, tenant_id, user_id):
|
||||
self.__tenant_id = tenant_id
|
||||
# TODO: enable super-constructor when OAuth is done
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from chalicelib.utils import jira_client
|
||||
from chalicelib.core.integration_base_issue import BaseIntegrationIssue
|
||||
from chalicelib.core.issue_tracking.base_issue import BaseIntegrationIssue
|
||||
|
||||
|
||||
class JIRACloudIntegrationIssue(BaseIntegrationIssue):
|
||||
|
|
@ -9,8 +9,8 @@ class JIRACloudIntegrationIssue(BaseIntegrationIssue):
|
|||
self._client = jira_client.JiraManager(self.url, self.username, token, None)
|
||||
super(JIRACloudIntegrationIssue, self).__init__("JIRA", token)
|
||||
|
||||
def create_new_assignment(self, integration_project_id, title, description, assignee, issue_type):
|
||||
self._client.set_jira_project_id(integration_project_id)
|
||||
def create_new_assignment(self, project_id, title, description, assignee, issue_type):
|
||||
self._client.set_jira_project_id(project_id)
|
||||
data = {
|
||||
'summary': title,
|
||||
'description': description,
|
||||
|
|
@ -28,26 +28,26 @@ class JIRACloudIntegrationIssue(BaseIntegrationIssue):
|
|||
projects_map[i["integrationProjectId"]].append(i["id"])
|
||||
|
||||
results = []
|
||||
for integration_project_id in projects_map:
|
||||
self._client.set_jira_project_id(integration_project_id)
|
||||
for project_id in projects_map:
|
||||
self._client.set_jira_project_id(project_id)
|
||||
jql = 'labels = OpenReplay'
|
||||
if len(projects_map[integration_project_id]) > 0:
|
||||
jql += f" AND ID IN ({','.join(projects_map[integration_project_id])})"
|
||||
if len(projects_map[project_id]) > 0:
|
||||
jql += f" AND ID IN ({','.join(projects_map[project_id])})"
|
||||
issues = self._client.get_issues(jql, offset=0)
|
||||
results += issues
|
||||
return {"issues": results}
|
||||
|
||||
def get(self, integration_project_id, assignment_id):
|
||||
self._client.set_jira_project_id(integration_project_id)
|
||||
def get(self, project_id, assignment_id):
|
||||
self._client.set_jira_project_id(project_id)
|
||||
return self._client.get_issue_v3(assignment_id)
|
||||
|
||||
def comment(self, integration_project_id, assignment_id, comment):
|
||||
self._client.set_jira_project_id(integration_project_id)
|
||||
def comment(self, project_id, assignment_id, comment):
|
||||
self._client.set_jira_project_id(project_id)
|
||||
return self._client.add_comment_v3(assignment_id, comment)
|
||||
|
||||
def get_metas(self, integration_project_id):
|
||||
def get_metas(self, project_id):
|
||||
meta = {}
|
||||
self._client.set_jira_project_id(integration_project_id)
|
||||
self._client.set_jira_project_id(project_id)
|
||||
meta['issueTypes'] = self._client.get_issue_types()
|
||||
meta['users'] = self._client.get_assignable_users()
|
||||
return {"provider": self.provider.lower(), **meta}
|
||||
1
api/chalicelib/core/issue_tracking/modules/__init__.py
Normal file
1
api/chalicelib/core/issue_tracking/modules/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
TENANT_CONDITION = "TRUE"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
from chalicelib.core import sessions_mobs, sessions_devtool
|
||||
from chalicelib.core.sessions import sessions_mobs, sessions_devtool
|
||||
|
||||
|
||||
class Actions:
|
||||
|
|
|
|||
0
api/chalicelib/core/log_tools/__init__.py
Normal file
0
api/chalicelib/core/log_tools/__init__.py
Normal file
|
|
@ -1,5 +1,6 @@
|
|||
from chalicelib.utils import pg_client, helper
|
||||
import json
|
||||
from chalicelib.core.log_tools.modules import TENANT_CONDITION
|
||||
|
||||
EXCEPT = ["jira_server", "jira_cloud"]
|
||||
|
||||
|
|
@ -94,11 +95,11 @@ def get_all_by_tenant(tenant_id, integration):
|
|||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify(
|
||||
"""SELECT integrations.*
|
||||
f"""SELECT integrations.*
|
||||
FROM public.integrations INNER JOIN public.projects USING(project_id)
|
||||
WHERE provider = %(provider)s
|
||||
WHERE provider = %(provider)s AND {TENANT_CONDITION}
|
||||
AND projects.deleted_at ISNULL;""",
|
||||
{"provider": integration})
|
||||
{"tenant_id": tenant_id, "provider": integration})
|
||||
)
|
||||
r = cur.fetchall()
|
||||
return helper.list_to_camel_case(r, flatten=True)
|
||||
1
api/chalicelib/core/log_tools/modules/__init__.py
Normal file
1
api/chalicelib/core/log_tools/modules/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
TENANT_CONDITION = "TRUE"
|
||||
0
api/chalicelib/core/sessions/__init__.py
Normal file
0
api/chalicelib/core/sessions/__init__.py
Normal file
|
|
@ -2,7 +2,8 @@ import logging
|
|||
from typing import List, Union
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import events, metadata, projects, performance_event, sessions_favorite
|
||||
from chalicelib.core import events, metadata, projects
|
||||
from chalicelib.core.sessions import sessions_favorite, performance_event
|
||||
from chalicelib.utils import pg_client, helper, metrics_helper
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ from decouple import config
|
|||
from chalicelib.utils import helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
from chalicelib.utils import pg_client
|
||||
from chalicelib.core import integrations_manager, integration_base_issue
|
||||
from chalicelib.core.issue_tracking import integrations_manager, base_issue
|
||||
import json
|
||||
|
||||
|
||||
|
|
@ -3,7 +3,8 @@ import logging
|
|||
from typing import List, Union
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import events, metadata, projects, performance_event, metrics, sessions_favorite, sessions
|
||||
from chalicelib.core import events, metadata, projects, metrics, sessions
|
||||
from chalicelib.core.sessions import sessions_favorite, performance_event
|
||||
from chalicelib.utils import pg_client, helper, metrics_helper, ch_client, exp_ch_helper
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import schemas
|
||||
from chalicelib.core import autocomplete
|
||||
from chalicelib.core.autocomplete import autocomplete
|
||||
from chalicelib.utils.event_filter_definition import SupportedFilter
|
||||
|
||||
SUPPORTED_TYPES = {
|
||||
|
|
@ -42,7 +42,7 @@ SUPPORTED_TYPES = {
|
|||
schemas.FilterType.UTM_SOURCE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_SOURCE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_SOURCE)),
|
||||
# IOS
|
||||
# Mobile
|
||||
schemas.FilterType.USER_OS_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS_MOBILE)),
|
||||
|
|
@ -4,8 +4,8 @@ from urllib.parse import urljoin
|
|||
from decouple import config
|
||||
|
||||
import schemas
|
||||
from chalicelib.core.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaboration_slack import Slack
|
||||
from chalicelib.core.collaborations.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaborations.collaboration_slack import Slack
|
||||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import schemas
|
||||
from chalicelib.core import events, metadata, events_mobile, \
|
||||
sessions_mobs, issues, assist, sessions_devtool, canvas, user_testing
|
||||
issues, assist, canvas, user_testing
|
||||
from chalicelib.core.sessions import sessions_mobs, sessions_devtool
|
||||
from chalicelib.utils import errors_helper
|
||||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
|
|
@ -4,13 +4,18 @@ from decouple import config
|
|||
from fastapi import Depends, Body, BackgroundTasks
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import log_tool_rollbar, sourcemaps, events, sessions_assignments, projects, alerts, issues, \
|
||||
integrations_manager, metadata, log_tool_elasticsearch, log_tool_datadog, log_tool_stackdriver, reset_password, \
|
||||
log_tool_cloudwatch, log_tool_sentry, log_tool_sumologic, log_tools, sessions, log_tool_newrelic, announcements, \
|
||||
log_tool_bugsnag, weekly_report, integration_jira_cloud, integration_github, assist, mobile, tenants, boarding, \
|
||||
notifications, webhook, users, custom_metrics, saved_search, integrations_global, tags, autocomplete
|
||||
from chalicelib.core.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaboration_slack import Slack
|
||||
from chalicelib.core import sourcemaps, events, projects, alerts, issues, \
|
||||
metadata, reset_password, \
|
||||
log_tools, sessions, announcements, \
|
||||
weekly_report, assist, mobile, tenants, boarding, \
|
||||
notifications, webhook, users, custom_metrics, saved_search, tags, autocomplete
|
||||
from chalicelib.core.issue_tracking import github, integrations_global, integrations_manager, \
|
||||
jira_cloud
|
||||
from chalicelib.core.log_tools import datadog, newrelic, stackdriver, elasticsearch, \
|
||||
sentry, bugsnag, cloudwatch, sumologic, rollbar
|
||||
from chalicelib.core.sessions import sessions_assignments
|
||||
from chalicelib.core.collaborations.collaboration_msteams import MSTeams
|
||||
from chalicelib.core.collaborations.collaboration_slack import Slack
|
||||
from or_dependencies import OR_context, OR_role
|
||||
from routers.base import get_routers
|
||||
|
||||
|
|
@ -65,16 +70,16 @@ def get_integrations_status(projectId: int, context: schemas.CurrentContext = De
|
|||
|
||||
|
||||
@app.post('/{projectId}/integrations/{integration}/notify/{webhookId}/{source}/{sourceId}', tags=["integrations"])
|
||||
def integration_notify(projectId: int, integration: str, webhookId: int, source: str, sourceId: str,
|
||||
data: schemas.IntegrationNotificationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def notify(projectId: int, integration: str, webhookId: int, source: str, sourceId: str,
|
||||
data: schemas.IntegrationNotificationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
comment = None
|
||||
if data.comment:
|
||||
comment = data.comment
|
||||
|
||||
args = {"tenant_id": context.tenant_id,
|
||||
"user": context.email, "comment": comment, "project_id": projectId,
|
||||
"integration_id": webhookId,
|
||||
"id": webhookId,
|
||||
"project_name": context.project.name}
|
||||
if integration == schemas.WebhookType.SLACK:
|
||||
if source == "sessions":
|
||||
|
|
@ -91,221 +96,221 @@ def integration_notify(projectId: int, integration: str, webhookId: int, source:
|
|||
|
||||
@app.get('/integrations/sentry', tags=["integrations"])
|
||||
def get_all_sentry(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": sentry.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def get_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.get(project_id=projectId)}
|
||||
return {"data": sentry.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def add_edit_sentry(projectId: int, data: schemas.IntegrationSentrySchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": sentry.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def delete_sentry(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": sentry.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sentry/events/{eventId}', tags=["integrations"])
|
||||
def proxy_sentry(projectId: int, eventId: str, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.proxy_get(tenant_id=context.tenant_id, project_id=projectId, event_id=eventId)}
|
||||
return {"data": sentry.proxy_get(tenant_id=context.tenant_id, project_id=projectId, event_id=eventId)}
|
||||
|
||||
|
||||
@app.get('/integrations/datadog', tags=["integrations"])
|
||||
def get_all_datadog(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": datadog.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def get_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.get(project_id=projectId)}
|
||||
return {"data": datadog.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def add_edit_datadog(projectId: int, data: schemas.IntegrationDatadogSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": datadog.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def delete_datadog(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": datadog.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/stackdriver', tags=["integrations"])
|
||||
def get_all_stackdriver(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": stackdriver.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def get_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.get(project_id=projectId)}
|
||||
return {"data": stackdriver.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def add_edit_stackdriver(projectId: int, data: schemas.IntegartionStackdriverSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": stackdriver.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def delete_stackdriver(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": stackdriver.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/newrelic', tags=["integrations"])
|
||||
def get_all_newrelic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": newrelic.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def get_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.get(project_id=projectId)}
|
||||
return {"data": newrelic.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def add_edit_newrelic(projectId: int, data: schemas.IntegrationNewrelicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": newrelic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def delete_newrelic(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": newrelic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/rollbar', tags=["integrations"])
|
||||
def get_all_rollbar(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": rollbar.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def get_rollbar(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.get(project_id=projectId)}
|
||||
return {"data": rollbar.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def add_edit_rollbar(projectId: int, data: schemas.IntegrationRollbarSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": rollbar.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def delete_datadog(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": rollbar.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/bugsnag/list_projects', tags=["integrations"])
|
||||
def list_projects_bugsnag(data: schemas.IntegrationBugsnagBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.list_projects(auth_token=data.authorization_token)}
|
||||
return {"data": bugsnag.list_projects(auth_token=data.authorization_token)}
|
||||
|
||||
|
||||
@app.get('/integrations/bugsnag', tags=["integrations"])
|
||||
def get_all_bugsnag(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": bugsnag.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def get_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.get(project_id=projectId)}
|
||||
return {"data": bugsnag.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def add_edit_bugsnag(projectId: int, data: schemas.IntegrationBugsnagSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": bugsnag.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def delete_bugsnag(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": bugsnag.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/cloudwatch/list_groups', tags=["integrations"])
|
||||
def list_groups_cloudwatch(data: schemas.IntegrationCloudwatchBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.list_log_groups(aws_access_key_id=data.awsAccessKeyId,
|
||||
aws_secret_access_key=data.awsSecretAccessKey,
|
||||
region=data.region)}
|
||||
return {"data": cloudwatch.list_log_groups(aws_access_key_id=data.awsAccessKeyId,
|
||||
aws_secret_access_key=data.awsSecretAccessKey,
|
||||
region=data.region)}
|
||||
|
||||
|
||||
@app.get('/integrations/cloudwatch', tags=["integrations"])
|
||||
def get_all_cloudwatch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": cloudwatch.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def get_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.get(project_id=projectId)}
|
||||
return {"data": cloudwatch.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def add_edit_cloudwatch(projectId: int, data: schemas.IntegrationCloudwatchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": cloudwatch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def delete_cloudwatch(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": cloudwatch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/elasticsearch', tags=["integrations"])
|
||||
def get_all_elasticsearch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": elasticsearch.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def get_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.get(project_id=projectId)}
|
||||
return {"data": elasticsearch.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/elasticsearch/test', tags=["integrations"])
|
||||
def test_elasticsearch_connection(data: schemas.IntegrationElasticsearchTestSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.ping(tenant_id=context.tenant_id, data=data)}
|
||||
return {"data": elasticsearch.ping(tenant_id=context.tenant_id, data=data)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def add_edit_elasticsearch(projectId: int, data: schemas.IntegrationElasticsearchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
"data": log_tool_elasticsearch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
"data": elasticsearch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def delete_elasticsearch(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": elasticsearch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/sumologic', tags=["integrations"])
|
||||
def get_all_sumologic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.get_all(tenant_id=context.tenant_id)}
|
||||
return {"data": sumologic.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def get_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.get(project_id=projectId)}
|
||||
return {"data": sumologic.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def add_edit_sumologic(projectId: int, data: schemas.IntegrationSumologicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
return {"data": sumologic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def delete_sumologic(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
return {"data": sumologic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/issues', tags=["integrations"])
|
||||
def get_integration_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def get_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None and integration is None:
|
||||
|
|
@ -314,20 +319,20 @@ def get_integration_status(context: schemas.CurrentContext = Depends(OR_context)
|
|||
|
||||
|
||||
@app.get('/integrations/jira', tags=["integrations"])
|
||||
def get_integration_status_jira(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def get_status_jira(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
tool=integration_jira_cloud.PROVIDER)
|
||||
tool=jira_cloud.PROVIDER)
|
||||
if error is not None and integration is None:
|
||||
return error
|
||||
return {"data": integration.get_obfuscated()}
|
||||
|
||||
|
||||
@app.get('/integrations/github', tags=["integrations"])
|
||||
def get_integration_status_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def get_status_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
tool=integration_github.PROVIDER)
|
||||
tool=github.PROVIDER)
|
||||
if error is not None and integration is None:
|
||||
return error
|
||||
return {"data": integration.get_obfuscated()}
|
||||
|
|
@ -338,7 +343,7 @@ def add_edit_jira_cloud(data: schemas.IssueTrackingJiraSchema = Body(...),
|
|||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if not str(data.url).rstrip('/').endswith('atlassian.net'):
|
||||
return {"errors": ["url must be a valid JIRA URL (example.atlassian.net)"]}
|
||||
error, integration = integrations_manager.get_integration(tool=integration_jira_cloud.PROVIDER,
|
||||
error, integration = integrations_manager.get_integration(tool=jira_cloud.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None and integration is None:
|
||||
|
|
@ -349,7 +354,7 @@ def add_edit_jira_cloud(data: schemas.IssueTrackingJiraSchema = Body(...),
|
|||
@app.post('/integrations/github', tags=["integrations"])
|
||||
def add_edit_github(data: schemas.IssueTrackingGithubSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_github.PROVIDER,
|
||||
error, integration = integrations_manager.get_integration(tool=github.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None:
|
||||
|
|
@ -368,7 +373,7 @@ def delete_default_issue_tracking_tool(_=Body(None), context: schemas.CurrentCon
|
|||
|
||||
@app.delete('/integrations/jira', tags=["integrations"])
|
||||
def delete_jira_cloud(_=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_jira_cloud.PROVIDER,
|
||||
error, integration = integrations_manager.get_integration(tool=jira_cloud.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
for_delete=True)
|
||||
|
|
@ -379,7 +384,7 @@ def delete_jira_cloud(_=Body(None), context: schemas.CurrentContext = Depends(OR
|
|||
|
||||
@app.delete('/integrations/github', tags=["integrations"])
|
||||
def delete_github(_=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_github.PROVIDER,
|
||||
error, integration = integrations_manager.get_integration(tool=github.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
for_delete=True)
|
||||
|
|
@ -404,7 +409,7 @@ def get_all_issue_tracking_projects(context: schemas.CurrentContext = Depends(OR
|
|||
|
||||
|
||||
@app.get('/integrations/issues/{integrationProjectId}', tags=["integrations"])
|
||||
def get_integration_metadata(integrationProjectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def get_metadata(integrationProjectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None:
|
||||
|
|
@ -726,7 +731,7 @@ def get_slack_channels(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
@app.get('/integrations/slack/{integrationId}', tags=["integrations"])
|
||||
def get_slack_webhook(integrationId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": Slack.get_integration(tenant_id=context.tenant_id, integration_id=integrationId)}
|
||||
return {"data": Slack.get_integration(tenant_id=context.tenant_id, id=integrationId)}
|
||||
|
||||
|
||||
@app.delete('/integrations/slack/{integrationId}', tags=["integrations"])
|
||||
|
|
@ -829,7 +834,7 @@ def add_msteams_integration(data: schemas.AddCollaborationSchema,
|
|||
def edit_msteams_integration(webhookId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if len(data.url.unicode_string()) > 0:
|
||||
old = MSTeams.get_integration(tenant_id=context.tenant_id, integration_id=webhookId)
|
||||
old = MSTeams.get_integration(tenant_id=context.tenant_id, id=webhookId)
|
||||
if not old:
|
||||
return {"errors": ["MsTeams integration not found."]}
|
||||
if old["endpoint"] != data.url.unicode_string():
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ from starlette.responses import RedirectResponse, FileResponse, JSONResponse, Re
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import scope
|
||||
from chalicelib.core import sessions, errors, errors_viewed, errors_favorite, sessions_assignments, heatmaps, \
|
||||
sessions_favorite, assist, sessions_notes, sessions_replay, signup, feature_flags
|
||||
from chalicelib.core import sessions_viewed
|
||||
from chalicelib.core import errors, errors_viewed, errors_favorite, heatmaps, \
|
||||
assist, signup, feature_flags
|
||||
from chalicelib.core.sessions import sessions, sessions_notes, sessions_replay, sessions_favorite, sessions_viewed, \
|
||||
sessions_assignments, unprocessed_sessions
|
||||
from chalicelib.core import tenants, users, projects, license
|
||||
from chalicelib.core import unprocessed_sessions
|
||||
from chalicelib.core import webhook
|
||||
from chalicelib.core.collaboration_slack import Slack
|
||||
from chalicelib.core.collaborations.collaboration_slack import Slack
|
||||
from chalicelib.utils import captcha, smtp
|
||||
from chalicelib.utils import helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
|
|
|||
|
|
@ -972,33 +972,51 @@ class CardSessionsSchema(_TimedSchema, _PaginatedSchema):
|
|||
|
||||
return self
|
||||
|
||||
# We don't need this as the UI is expecting filters to override the full series' filters
|
||||
# @model_validator(mode="after")
|
||||
# def __merge_out_filters_with_series(self):
|
||||
# for f in self.filters:
|
||||
# for s in self.series:
|
||||
# found = False
|
||||
#
|
||||
# if f.is_event:
|
||||
# sub = s.filter.events
|
||||
# else:
|
||||
# sub = s.filter.filters
|
||||
#
|
||||
# for e in sub:
|
||||
# if f.type == e.type and f.operator == e.operator:
|
||||
# found = True
|
||||
# if f.is_event:
|
||||
# # If extra event: append value
|
||||
# for v in f.value:
|
||||
# if v not in e.value:
|
||||
# e.value.append(v)
|
||||
# else:
|
||||
# # If extra filter: override value
|
||||
# e.value = f.value
|
||||
# if not found:
|
||||
# sub.append(f)
|
||||
#
|
||||
# self.filters = []
|
||||
#
|
||||
# return self
|
||||
|
||||
# UI is expecting filters to override the full series' filters
|
||||
@model_validator(mode="after")
|
||||
def __merge_out_filters_with_series(self):
|
||||
for f in self.filters:
|
||||
for s in self.series:
|
||||
found = False
|
||||
|
||||
def __override_series_filters_with_outer_filters(self):
|
||||
if len(self.filters) > 0:
|
||||
events = []
|
||||
filters = []
|
||||
for f in self.filters:
|
||||
if f.is_event:
|
||||
sub = s.filter.events
|
||||
events.append(f)
|
||||
else:
|
||||
sub = s.filter.filters
|
||||
|
||||
for e in sub:
|
||||
if f.type == e.type and f.operator == e.operator:
|
||||
found = True
|
||||
if f.is_event:
|
||||
# If extra event: append value
|
||||
for v in f.value:
|
||||
if v not in e.value:
|
||||
e.value.append(v)
|
||||
else:
|
||||
# If extra filter: override value
|
||||
e.value = f.value
|
||||
if not found:
|
||||
sub.append(f)
|
||||
|
||||
filters.append(f)
|
||||
for s in self.series:
|
||||
s.filter.events = events
|
||||
s.filter.filters = filters
|
||||
self.filters = []
|
||||
|
||||
return self
|
||||
|
||||
|
||||
|
|
|
|||
40
ee/api/.gitignore
vendored
40
ee/api/.gitignore
vendored
|
|
@ -187,12 +187,9 @@ Pipfile.lock
|
|||
/chalicelib/core/announcements.py
|
||||
/chalicelib/core/assist.py
|
||||
/chalicelib/core/authorizers.py
|
||||
/chalicelib/core/autocomplete.py
|
||||
/chalicelib/core/autocomplete_exp.py
|
||||
/chalicelib/core/autocomplete/*
|
||||
/chalicelib/core/canvas.py
|
||||
/chalicelib/core/collaboration_base.py
|
||||
/chalicelib/core/collaboration_msteams.py
|
||||
/chalicelib/core/collaboration_slack.py
|
||||
/chalicelib/core/collaborations/*
|
||||
/chalicelib/core/countries.py
|
||||
/chalicelib/core/metrics.py
|
||||
/chalicelib/core/custom_metrics.py
|
||||
|
|
@ -202,31 +199,20 @@ Pipfile.lock
|
|||
/chalicelib/core/events_mobile.py
|
||||
/chalicelib/core/feature_flags.py
|
||||
/chalicelib/core/funnels.py
|
||||
/chalicelib/core/integration_base.py
|
||||
/chalicelib/core/integration_base_issue.py
|
||||
/chalicelib/core/integration_github.py
|
||||
/chalicelib/core/integration_github_issue.py
|
||||
/chalicelib/core/integration_jira_cloud.py
|
||||
/chalicelib/core/integration_jira_cloud_issue.py
|
||||
/chalicelib/core/integrations_manager.py
|
||||
/chalicelib/core/issue_tracking/*.py
|
||||
/chalicelib/core/issues.py
|
||||
/chalicelib/core/jobs.py
|
||||
/chalicelib/core/log_tool_bugsnag.py
|
||||
/chalicelib/core/log_tool_cloudwatch.py
|
||||
/chalicelib/core/log_tool_datadog.py
|
||||
/chalicelib/core/log_tool_elasticsearch.py
|
||||
/chalicelib/core/log_tool_newrelic.py
|
||||
/chalicelib/core/log_tool_rollbar.py
|
||||
/chalicelib/core/log_tool_sentry.py
|
||||
/chalicelib/core/log_tool_stackdriver.py
|
||||
/chalicelib/core/log_tool_sumologic.py
|
||||
/chalicelib/core/log_tools/*.py
|
||||
/chalicelib/core/metadata.py
|
||||
/chalicelib/core/mobile.py
|
||||
/chalicelib/core/performance_event.py
|
||||
/chalicelib/core/saved_search.py
|
||||
/chalicelib/core/sessions.py
|
||||
/chalicelib/core/sessions_assignments.py
|
||||
/chalicelib/core/sessions_mobs.py
|
||||
/chalicelib/core/sessions/sessions.py
|
||||
/chalicelib/core/sessions/sessions_ch.py
|
||||
/chalicelib/core/sessions/sessions_assignments.py
|
||||
/chalicelib/core/sessions/sessions_metas.py
|
||||
/chalicelib/core/sessions/sessions_mobs.py
|
||||
/chalicelib/core/sessions/performance_event.py
|
||||
/chalicelib/core/sessions/unprocessed_sessions.py
|
||||
/chalicelib/core/significance.py
|
||||
/chalicelib/core/socket_ios.py
|
||||
/chalicelib/core/sourcemaps.py
|
||||
|
|
@ -278,7 +264,6 @@ Pipfile.lock
|
|||
/chalicelib/utils/or_cache/
|
||||
/routers/subs/health.py
|
||||
/chalicelib/core/spot.py
|
||||
/chalicelib/core/unprocessed_sessions.py
|
||||
/run-db_init-dev.sh
|
||||
/.dev/
|
||||
/chalicelib/core/product_anaytics2.py
|
||||
|
|
@ -289,4 +274,5 @@ Pipfile.lock
|
|||
/chalicelib/core/alerts/alerts.py
|
||||
/chalicelib/core/alerts/alerts_processor.py
|
||||
/chalicelib/core/alerts/alerts_processor_ch.py
|
||||
/chalicelib/core/sessions_ch.py
|
||||
/chalicelib/core/alerts/alerts_listener.py
|
||||
/chalicelib/core/alerts/modules/helpers.py
|
||||
|
|
|
|||
|
|
@ -1,44 +1,33 @@
|
|||
from decouple import config
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
from decouple import config
|
||||
|
||||
from . import sessions as sessions_legacy
|
||||
logger = logging.getLogger(__name__)
|
||||
from . import custom_metrics as custom_metrics_legacy
|
||||
from . import custom_metrics_ee as custom_metrics
|
||||
from . import metrics_ch as metrics
|
||||
from . import metrics as metrics_legacy
|
||||
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental sessions search")
|
||||
from . import sessions_ch as sessions
|
||||
else:
|
||||
from . import sessions as sessions
|
||||
|
||||
if config("EXP_AUTOCOMPLETE", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental autocomplete")
|
||||
from . import autocomplete_exp as autocomplete
|
||||
logger.info(">>> Using experimental autocomplete")
|
||||
else:
|
||||
from . import autocomplete as autocomplete
|
||||
|
||||
if config("EXP_ERRORS_SEARCH", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental error search")
|
||||
logger.info(">>> Using experimental error search")
|
||||
from . import errors as errors_legacy
|
||||
from . import errors_exp as errors
|
||||
|
||||
if config("EXP_ERRORS_GET", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental error get")
|
||||
logger.info(">>> Using experimental error get")
|
||||
else:
|
||||
from . import errors as errors
|
||||
|
||||
if config("EXP_SESSIONS_SEARCH_METRIC", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental sessions search for metrics")
|
||||
logger.info(">>> Using experimental sessions search for metrics")
|
||||
|
||||
if config("EXP_FUNNELS", cast=bool, default=False):
|
||||
logging.info(">>> Using experimental funnels")
|
||||
if not config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
from . import sessions as sessions_legacy
|
||||
|
||||
logger.info(">>> Using experimental funnels")
|
||||
from . import significance_exp as significance
|
||||
else:
|
||||
from . import significance as significance
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
from chalicelib.utils import pg_client, helper
|
||||
|
||||
|
||||
def get_all_alerts():
|
||||
with pg_client.PostgresClient(long_query=True) as cur:
|
||||
query = """SELECT tenant_id,
|
||||
alert_id,
|
||||
projects.project_id,
|
||||
projects.name AS project_name,
|
||||
detection_method,
|
||||
query,
|
||||
options,
|
||||
(EXTRACT(EPOCH FROM alerts.created_at) * 1000)::BIGINT AS created_at,
|
||||
alerts.name,
|
||||
alerts.series_id,
|
||||
filter,
|
||||
change,
|
||||
COALESCE(metrics.name || '.' || (COALESCE(metric_series.name, 'series ' || index)) || '.count',
|
||||
query ->> 'left') AS series_name
|
||||
FROM public.alerts
|
||||
INNER JOIN projects USING (project_id)
|
||||
LEFT JOIN metric_series USING (series_id)
|
||||
LEFT JOIN metrics USING (metric_id)
|
||||
WHERE alerts.deleted_at ISNULL
|
||||
AND alerts.active
|
||||
AND projects.active
|
||||
AND projects.deleted_at ISNULL
|
||||
AND (alerts.series_id ISNULL OR metric_series.deleted_at ISNULL)
|
||||
ORDER BY alerts.created_at;"""
|
||||
cur.execute(query=query)
|
||||
all_alerts = helper.list_to_camel_case(cur.fetchall())
|
||||
return all_alerts
|
||||
16
ee/api/chalicelib/core/alerts/modules/__init__.py
Normal file
16
ee/api/chalicelib/core/alerts/modules/__init__.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from decouple import config
|
||||
|
||||
TENANT_ID = "tenant_id"
|
||||
if config("EXP_ALERTS", cast=bool, default=False):
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
from chalicelib.core.sessions import sessions
|
||||
else:
|
||||
from chalicelib.core.sessions import sessions_ch as sessions
|
||||
else:
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
from chalicelib.core.sessions import sessions_ch as sessions
|
||||
else:
|
||||
from chalicelib.core.sessions import sessions
|
||||
|
||||
|
||||
from . import helpers as alert_helpers
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
from decouple import config
|
||||
|
||||
if config("EXP_ALERTS", cast=bool, default=False):
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
from chalicelib.core.sessions import *
|
||||
else:
|
||||
from chalicelib.core.sessions_legacy import *
|
||||
else:
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
from chalicelib.core.sessions_legacy import *
|
||||
else:
|
||||
from chalicelib.core.sessions import *
|
||||
|
|
@ -4,7 +4,7 @@ from decouple import config
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import issues
|
||||
from chalicelib.core import sessions_metas
|
||||
from chalicelib.core.sessions import sessions_metas
|
||||
from chalicelib.utils import pg_client, helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
from chalicelib.utils.event_filter_definition import SupportedFilter, Event
|
||||
|
|
@ -169,22 +169,22 @@ SUPPORTED_TYPES = {
|
|||
query=None),
|
||||
# IOS
|
||||
EventType.CLICK_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CLICK_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.CLICK_MOBILE.ui_type)),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.CLICK_MOBILE.ui_type)),
|
||||
EventType.INPUT_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.INPUT_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.INPUT_MOBILE.ui_type)),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.INPUT_MOBILE.ui_type)),
|
||||
EventType.VIEW_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.VIEW_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.VIEW_MOBILE.ui_type)),
|
||||
EventType.CUSTOM_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CUSTOM_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.CUSTOM_MOBILE.ui_type)),
|
||||
EventType.REQUEST_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.REQUEST_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.REQUEST_MOBILE.ui_type)),
|
||||
typename=EventType.VIEW_MOBILE.ui_type)),
|
||||
EventType.CUSTOM_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.CUSTOM_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.CUSTOM_MOBILE.ui_type)),
|
||||
EventType.REQUEST_MOBILE.ui_type: SupportedFilter(get=autocomplete.__generic_autocomplete(EventType.REQUEST_MOBILE),
|
||||
query=autocomplete.__generic_query(
|
||||
typename=EventType.REQUEST_MOBILE.ui_type)),
|
||||
EventType.CRASH_MOBILE.ui_type: SupportedFilter(get=autocomplete.__search_errors_mobile,
|
||||
query=None),
|
||||
query=None),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
TENANT_CONDITION = "tenant_id=%(tenant_id)s"
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
from chalicelib.utils import pg_client, helper
|
||||
import json
|
||||
|
||||
EXCEPT = ["jira_server", "jira_cloud"]
|
||||
|
||||
|
||||
def search(project_id):
|
||||
result = []
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify(
|
||||
"""\
|
||||
SELECT supported_integrations.name,
|
||||
(SELECT COUNT(*)
|
||||
FROM public.integrations
|
||||
INNER JOIN public.projects USING (project_id)
|
||||
WHERE provider = supported_integrations.name
|
||||
AND project_id = %(project_id)s
|
||||
AND projects.deleted_at ISNULL
|
||||
LIMIT 1) AS count
|
||||
FROM unnest(enum_range(NULL::integration_provider)) AS supported_integrations(name);""",
|
||||
{"project_id": project_id})
|
||||
)
|
||||
r = cur.fetchall()
|
||||
for k in r:
|
||||
if k["count"] > 0 and k["name"] not in EXCEPT:
|
||||
result.append({"value": helper.key_to_camel_case(k["name"]), "type": "logTool"})
|
||||
return {"data": result}
|
||||
|
||||
|
||||
def add(project_id, integration, options):
|
||||
options = json.dumps(options)
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify(
|
||||
"""\
|
||||
INSERT INTO public.integrations(project_id, provider, options)
|
||||
VALUES (%(project_id)s, %(provider)s, %(options)s::jsonb)
|
||||
RETURNING *;""",
|
||||
{"project_id": project_id, "provider": integration, "options": options})
|
||||
)
|
||||
r = cur.fetchone()
|
||||
return helper.dict_to_camel_case(helper.flatten_nested_dicts(r))
|
||||
|
||||
|
||||
def get(project_id, integration):
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify(
|
||||
"""\
|
||||
SELECT integrations.*
|
||||
FROM public.integrations INNER JOIN public.projects USING(project_id)
|
||||
WHERE provider = %(provider)s
|
||||
AND project_id = %(project_id)s
|
||||
AND projects.deleted_at ISNULL
|
||||
LIMIT 1;""",
|
||||
{"project_id": project_id, "provider": integration})
|
||||
)
|
||||
r = cur.fetchone()
|
||||
return helper.dict_to_camel_case(helper.flatten_nested_dicts(r))
|
||||
|
||||
|
||||
def edit(project_id, integration, changes):
|
||||
if "projectId" in changes:
|
||||
changes.pop("project_id")
|
||||
if "integration" in changes:
|
||||
changes.pop("integration")
|
||||
if len(changes.keys()) == 0:
|
||||
return None
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify("""\
|
||||
UPDATE public.integrations
|
||||
SET options=options||%(changes)s
|
||||
WHERE project_id =%(project_id)s AND provider = %(provider)s
|
||||
RETURNING *;""",
|
||||
{"project_id": project_id, "provider": integration, "changes": json.dumps(changes)})
|
||||
)
|
||||
return helper.dict_to_camel_case(helper.flatten_nested_dicts(cur.fetchone()))
|
||||
|
||||
|
||||
def delete(project_id, integration):
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify("""\
|
||||
DELETE FROM public.integrations
|
||||
WHERE project_id=%(project_id)s AND provider=%(provider)s;""",
|
||||
{"project_id": project_id, "provider": integration})
|
||||
)
|
||||
return {"state": "success"}
|
||||
|
||||
|
||||
def get_all_by_tenant(tenant_id, integration):
|
||||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify(
|
||||
"""\
|
||||
SELECT integrations.*
|
||||
FROM public.integrations INNER JOIN public.projects USING(project_id)
|
||||
WHERE provider = %(provider)s
|
||||
AND tenant_id = %(tenant_id)s
|
||||
AND projects.deleted_at ISNULL;""",
|
||||
{"tenant_id": tenant_id, "provider": integration})
|
||||
)
|
||||
r = cur.fetchall()
|
||||
return helper.list_to_camel_case(r, flatten=True)
|
||||
1
ee/api/chalicelib/core/log_tools/modules/__init__.py
Normal file
1
ee/api/chalicelib/core/log_tools/modules/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
TENANT_CONDITION = "tenant_id = %(tenant_id)s"
|
||||
12
ee/api/chalicelib/core/sessions/__init__.py
Normal file
12
ee/api/chalicelib/core/sessions/__init__.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import logging
|
||||
|
||||
from decouple import config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
from . import sessions as sessions_legacy
|
||||
|
||||
if config("EXP_SESSIONS_SEARCH", cast=bool, default=False):
|
||||
logger.info(">>> Using experimental sessions search")
|
||||
from . import sessions_ch as sessions
|
||||
else:
|
||||
from . import sessions
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
import schemas
|
||||
from chalicelib.utils.event_filter_definition import SupportedFilter
|
||||
from decouple import config
|
||||
|
||||
if config("EXP_AUTOCOMPLETE", cast=bool, default=False):
|
||||
from . import autocomplete_exp as autocomplete
|
||||
else:
|
||||
from . import autocomplete as autocomplete
|
||||
|
||||
SUPPORTED_TYPES = {
|
||||
schemas.FilterType.USER_OS: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS)),
|
||||
schemas.FilterType.USER_BROWSER: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_BROWSER),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_BROWSER)),
|
||||
schemas.FilterType.USER_DEVICE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_DEVICE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_DEVICE)),
|
||||
schemas.FilterType.USER_COUNTRY: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_COUNTRY),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_COUNTRY)),
|
||||
schemas.FilterType.USER_CITY: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_CITY),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_CITY)),
|
||||
schemas.FilterType.USER_STATE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_STATE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_STATE)),
|
||||
schemas.FilterType.USER_ID: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ID),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ID)),
|
||||
schemas.FilterType.USER_ANONYMOUS_ID: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ANONYMOUS_ID),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ANONYMOUS_ID)),
|
||||
schemas.FilterType.REV_ID: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REV_ID),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REV_ID)),
|
||||
schemas.FilterType.REFERRER: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REFERRER),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REFERRER)),
|
||||
schemas.FilterType.UTM_CAMPAIGN: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_CAMPAIGN),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_CAMPAIGN)),
|
||||
schemas.FilterType.UTM_MEDIUM: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_MEDIUM),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_MEDIUM)),
|
||||
schemas.FilterType.UTM_SOURCE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_SOURCE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.UTM_SOURCE)),
|
||||
# MOBILE
|
||||
schemas.FilterType.USER_OS_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_OS_MOBILE)),
|
||||
schemas.FilterType.USER_DEVICE_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(
|
||||
typename=schemas.FilterType.USER_DEVICE_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_DEVICE_MOBILE)),
|
||||
schemas.FilterType.USER_COUNTRY_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_COUNTRY_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_COUNTRY_MOBILE)),
|
||||
schemas.FilterType.USER_ID_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ID_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ID_MOBILE)),
|
||||
schemas.FilterType.USER_ANONYMOUS_ID_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ANONYMOUS_ID_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.USER_ANONYMOUS_ID_MOBILE)),
|
||||
schemas.FilterType.REV_ID_MOBILE: SupportedFilter(
|
||||
get=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REV_ID_MOBILE),
|
||||
query=autocomplete.__generic_autocomplete_metas(typename=schemas.FilterType.REV_ID_MOBILE)),
|
||||
|
||||
}
|
||||
|
||||
|
||||
def search(text: str, meta_type: schemas.FilterType, project_id: int):
|
||||
rows = []
|
||||
if meta_type not in list(SUPPORTED_TYPES.keys()):
|
||||
return {"errors": ["unsupported type"]}
|
||||
rows += SUPPORTED_TYPES[meta_type].get(project_id=project_id, text=text)
|
||||
# for IOS events autocomplete
|
||||
# if meta_type + "_IOS" in list(SUPPORTED_TYPES.keys()):
|
||||
# rows += SUPPORTED_TYPES[meta_type + "_IOS"].get(project_id=project_id, text=text)
|
||||
return {"data": rows}
|
||||
|
|
@ -9,11 +9,8 @@ rm -rf ./build_crons.sh
|
|||
rm -rf ./chalicelib/core/announcements.py
|
||||
rm -rf ./chalicelib/core/assist.py
|
||||
rm -rf ./chalicelib/core/authorizers.py
|
||||
rm -rf ./chalicelib/core/autocomplete.py
|
||||
rm -rf ./chalicelib/core/autocomplete_exp.py
|
||||
rm -rf ./chalicelib/core/collaboration_base.py
|
||||
rm -rf ./chalicelib/core/collaboration_msteams.py
|
||||
rm -rf ./chalicelib/core/collaboration_slack.py
|
||||
rm -rf ./chalicelib/core/autocomplete
|
||||
rm -rf ./chalicelib/core/collaborations
|
||||
rm -rf ./chalicelib/core/countries.py
|
||||
rm -rf ./chalicelib/core/metrics.py
|
||||
rm -rf ./chalicelib/core/custom_metrics.py
|
||||
|
|
@ -23,31 +20,21 @@ rm -rf ./chalicelib/core/errors_favorite.py
|
|||
rm -rf ./chalicelib/core/events_mobile.py
|
||||
rm -rf ./chalicelib/core/feature_flags.py
|
||||
rm -rf ./chalicelib/core/funnels.py
|
||||
rm -rf ./chalicelib/core/integration_base.py
|
||||
rm -rf ./chalicelib/core/integration_base_issue.py
|
||||
rm -rf ./chalicelib/core/integration_github.py
|
||||
rm -rf ./chalicelib/core/integration_github_issue.py
|
||||
rm -rf ./chalicelib/core/integration_jira_cloud.py
|
||||
rm -rf ./chalicelib/core/integration_jira_cloud_issue.py
|
||||
rm -rf ./chalicelib/core/issue_tracking/*.py
|
||||
rm -rf ./chalicelib/core/integrations_manager.py
|
||||
rm -rf ./chalicelib/core/issues.py
|
||||
rm -rf ./chalicelib/core/jobs.py
|
||||
rm -rf ./chalicelib/core/log_tool_bugsnag.py
|
||||
rm -rf ./chalicelib/core/log_tool_cloudwatch.py
|
||||
rm -rf ./chalicelib/core/log_tool_datadog.py
|
||||
rm -rf ./chalicelib/core/log_tool_elasticsearch.py
|
||||
rm -rf ./chalicelib/core/log_tool_newrelic.py
|
||||
rm -rf ./chalicelib/core/log_tool_rollbar.py
|
||||
rm -rf ./chalicelib/core/log_tool_sentry.py
|
||||
rm -rf ./chalicelib/core/log_tool_stackdriver.py
|
||||
rm -rf ./chalicelib/core/log_tool_sumologic.py
|
||||
rm -rf ./chalicelib/core/log_tools/*.py
|
||||
rm -rf ./chalicelib/core/metadata.py
|
||||
rm -rf ./chalicelib/core/mobile.py
|
||||
rm -rf ./chalicelib/core/performance_event.py
|
||||
rm -rf ./chalicelib/core/saved_search.py
|
||||
rm -rf ./chalicelib/core/sessions.py
|
||||
rm -rf ./chalicelib/core/sessions_assignments.py
|
||||
rm -rf ./chalicelib/core/sessions_mobs.py
|
||||
rm -rf ./chalicelib/core/sessions/sessions.py
|
||||
rm -rf ./chalicelib/core/sessions/sessions_ch.py
|
||||
rm -rf ./chalicelib/core/sessions/sessions_assignments.py
|
||||
rm -rf ./chalicelib/core/sessions/sessions_metas.py
|
||||
rm -rf ./chalicelib/core/sessions/sessions_mobs.py
|
||||
rm -rf ./chalicelib/core/sessions/performance_event.py
|
||||
rm -rf ./chalicelib/core/sessions/unprocessed_sessions.py
|
||||
rm -rf ./chalicelib/core/significance.py
|
||||
rm -rf ./chalicelib/core/socket_ios.py
|
||||
rm -rf ./chalicelib/core/sourcemaps.py
|
||||
|
|
@ -99,7 +86,6 @@ rm -rf ./chalicelib/core/db_request_handler.py
|
|||
rm -rf ./chalicelib/utils/or_cache
|
||||
rm -rf ./routers/subs/health.py
|
||||
rm -rf ./chalicelib/core/spot.py
|
||||
rm -rf ./chalicelib/core/unprocessed_sessions.py
|
||||
rm -rf ./chalicelib/core/product_anaytics2.py
|
||||
rm -rf ./chalicelib/utils/ch_client.py
|
||||
rm -rf ./chalicelib/utils/ch_client_exp.py
|
||||
|
|
@ -108,4 +94,5 @@ rm -rf ./chalicelib/core/alerts/__init__.py
|
|||
rm -rf ./chalicelib/core/alerts/alerts.py
|
||||
rm -rf ./chalicelib/core/alerts/alerts_processor.py
|
||||
rm -rf ./chalicelib/core/alerts/alerts_processor_ch.py
|
||||
rm -rf ./chalicelib/core/sessions_ch.py
|
||||
rm -rf ./chalicelib/core/alerts/alerts_listener.py
|
||||
rm -rf ./chalicelib/core/alerts/modules/helpers.py
|
||||
|
|
|
|||
|
|
@ -8,13 +8,12 @@ from starlette.responses import RedirectResponse, FileResponse, JSONResponse, Re
|
|||
|
||||
import schemas
|
||||
from chalicelib.core import scope
|
||||
from chalicelib.core import sessions, assist, heatmaps, sessions_favorite, sessions_assignments, errors, errors_viewed, \
|
||||
errors_favorite, sessions_notes, sessions_replay, signup, feature_flags
|
||||
from chalicelib.core import sessions_viewed
|
||||
from chalicelib.core import assist, heatmaps, errors, errors_viewed, errors_favorite, signup, feature_flags
|
||||
from chalicelib.core.sessions import sessions, sessions_notes, sessions_replay, sessions_favorite, sessions_assignments, \
|
||||
sessions_viewed, unprocessed_sessions
|
||||
from chalicelib.core import tenants, users, projects, license
|
||||
from chalicelib.core import unprocessed_sessions
|
||||
from chalicelib.core import webhook
|
||||
from chalicelib.core.collaboration_slack import Slack
|
||||
from chalicelib.core.collaborations.collaboration_slack import Slack
|
||||
from chalicelib.utils import SAML2_helper, smtp
|
||||
from chalicelib.utils import captcha
|
||||
from chalicelib.utils import helper
|
||||
|
|
|
|||
|
|
@ -204,10 +204,13 @@ class SpotPlayerStore {
|
|||
|
||||
this.network = network.map((request) => {
|
||||
const ev = { ...request, timestamp: request.time };
|
||||
return getResourceFromNetworkRequest(
|
||||
const req = getResourceFromNetworkRequest(
|
||||
mapSpotNetworkToEv(ev),
|
||||
this.startTs
|
||||
);
|
||||
return {
|
||||
...req, timestamp: request.timestamp,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -1,3 +1,3 @@
|
|||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.5.1.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.5.3.cjs
|
||||
|
|
|
|||
BIN
spot/bun.lockb
BIN
spot/bun.lockb
Binary file not shown.
|
|
@ -2,26 +2,29 @@ import { createSignal, onMount } from "solid-js";
|
|||
import orLogo from "~/assets/orSpot.svg";
|
||||
import arrowLeft from "~/assets/arrow-left.svg";
|
||||
|
||||
const defaultIngest = "https://app.openreplay.com";
|
||||
|
||||
function Settings({ goBack }: { goBack: () => void }) {
|
||||
const [includeDevTools, setIncludeDevTools] = createSignal(true);
|
||||
const [openInNewTab, setOpenInNewTab] = createSignal(true);
|
||||
const [showIngest, setShowIngest] = createSignal(false);
|
||||
const [ingest, setIngest] = createSignal("https://app.openreplay.com");
|
||||
const [ingest, setIngest] = createSignal(defaultIngest);
|
||||
const [editIngest, setEditIngest] = createSignal(false);
|
||||
const [tempIngest, setTempIngest] = createSignal("");
|
||||
|
||||
onMount(() => {
|
||||
chrome.storage.local.get("settings", (data: any) => {
|
||||
if (data.settings) {
|
||||
console.log('update state', data.settings)
|
||||
const ingest =
|
||||
data.settings.ingestPoint || "https://app.openreplay.com";
|
||||
data.settings.ingestPoint || defaultIngest;
|
||||
const devToolsEnabled =
|
||||
data.settings.consoleLogs && data.settings.networkLogs;
|
||||
setOpenInNewTab(data.settings.openInNewTab ?? false);
|
||||
setIncludeDevTools(devToolsEnabled);
|
||||
setIngest(ingest);
|
||||
setTempIngest(ingest);
|
||||
setShowIngest(ingest !== "https://app.openreplay.com");
|
||||
setShowIngest(ingest !== defaultIngest);
|
||||
setEditIngest(!data.settings.ingestPoint);
|
||||
}
|
||||
});
|
||||
|
|
@ -38,15 +41,19 @@ function Settings({ goBack }: { goBack: () => void }) {
|
|||
});
|
||||
};
|
||||
|
||||
const toggleShowIngest = (e: Event) => {
|
||||
const toggleShowIngest = (e: any) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const value = showIngest();
|
||||
setShowIngest(!value);
|
||||
const value = e.target.checked
|
||||
const newSettings = { showIngest: value }
|
||||
if (!value) {
|
||||
newSettings['ingestPoint'] = defaultIngest
|
||||
}
|
||||
chrome.runtime.sendMessage({
|
||||
type: "ort:settings",
|
||||
settings: { showIngest: !value },
|
||||
settings: newSettings,
|
||||
});
|
||||
setShowIngest(value);
|
||||
};
|
||||
|
||||
const applyIngest = () => {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "wxt-starter",
|
||||
"name": "spot",
|
||||
"description": "manifest.json description",
|
||||
"private": true,
|
||||
"version": "1.0.11",
|
||||
"version": "1.0.13",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "wxt",
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
"prettier": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@neodrag/solid": "^2.0.4",
|
||||
"@openreplay/network-proxy": "^1.0.3",
|
||||
"@neodrag/solid": "^2.2.0",
|
||||
"@openreplay/network-proxy": "^1.0.5",
|
||||
"@thedutchcoder/postcss-rem-to-px": "^0.0.2",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"install": "^0.13.0",
|
||||
|
|
@ -29,10 +29,10 @@
|
|||
"web-vitals": "^4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wxt-dev/module-solid": "^1.1.2",
|
||||
"@wxt-dev/module-solid": "^1.1.3",
|
||||
"daisyui": "^4.12.10",
|
||||
"typescript": "^5.4.5",
|
||||
"wxt": "0.19.13"
|
||||
"typescript": "^5.7.2",
|
||||
"wxt": "0.19.22"
|
||||
},
|
||||
"packageManager": "yarn@4.5.1"
|
||||
"packageManager": "yarn@4.5.3"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export interface SpotNetworkRequest {
|
|||
responseBody: string;
|
||||
requestHeaders: Record<string, string>;
|
||||
responseHeaders: Record<string, string>;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export const sensitiveParams = new Set([
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ export function createSpotNetworkRequest(
|
|||
requestHeaders: reqHeaders,
|
||||
responseHeaders: resHeaders,
|
||||
time: msg.startTime,
|
||||
timestamp: Date.now(),
|
||||
statusCode: msg.status || 0,
|
||||
error: undefined,
|
||||
url: tryFilterUrl(msg.url),
|
||||
|
|
|
|||
7221
spot/yarn.lock
7221
spot/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue