t-bug-catcher 0.6.0__tar.gz → 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/PKG-INFO +1 -1
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/setup.cfg +1 -1
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/setup.py +1 -1
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/bug_catcher.py +3 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/jira.py +13 -2
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/utils/common.py +14 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/PKG-INFO +1 -1
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/MANIFEST.in +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/README.rst +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/pyproject.toml +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/requirements.txt +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/config.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/resources/whispers_config.yml +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/stack_saver.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/utils/logger.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher/workitems.py +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/requires.txt +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.6.0 → t_bug_catcher-0.6.1}/tests/test_t_bug_catcher.py +0 -0
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
|
|
27
27
|
test_suite="tests",
|
|
28
28
|
url="https://www.thoughtful.ai/",
|
|
29
|
-
version="0.6.
|
|
29
|
+
version="0.6.1",
|
|
30
30
|
zip_safe=False,
|
|
31
31
|
install_requires=install_requirements,
|
|
32
32
|
include_package_data=True,
|
|
@@ -110,6 +110,7 @@ class BugCatcher:
|
|
|
110
110
|
metadata: Optional[dict] = None,
|
|
111
111
|
attachments: Optional[List] = None,
|
|
112
112
|
assignee: Optional[str] = None,
|
|
113
|
+
team: Optional[str] = None,
|
|
113
114
|
):
|
|
114
115
|
"""Reports an error to the Jira project.
|
|
115
116
|
|
|
@@ -119,6 +120,7 @@ class BugCatcher:
|
|
|
119
120
|
metadata (dict, optional): The metadata to be added to the Jira issue. Defaults to None.
|
|
120
121
|
attachments (List, optional): The attachments to be added to the Jira issue. Defaults to None.
|
|
121
122
|
assignee (str, optional): The assignee to be added to the Jira issue. Defaults to None.
|
|
123
|
+
team (str, optional): The team to be assigned to the Jira issue. Defaults to None.
|
|
122
124
|
|
|
123
125
|
Returns:
|
|
124
126
|
None
|
|
@@ -175,6 +177,7 @@ class BugCatcher:
|
|
|
175
177
|
self.__jira.report_error(
|
|
176
178
|
exception=exception,
|
|
177
179
|
assignee=assignee,
|
|
180
|
+
team=team,
|
|
178
181
|
attachments=attachments,
|
|
179
182
|
stack_trace=stack_trace,
|
|
180
183
|
additional_info=description,
|
|
@@ -21,7 +21,7 @@ from retry import retry
|
|
|
21
21
|
from .config import CONFIG
|
|
22
22
|
from .exceptions import BadRequestError
|
|
23
23
|
from .utils import logger
|
|
24
|
-
from .utils.common import Encoder, get_frames, retrieve_build_info
|
|
24
|
+
from .utils.common import Encoder, get_frames, remove_holotree_id, retrieve_build_info
|
|
25
25
|
from .workitems import variables
|
|
26
26
|
|
|
27
27
|
|
|
@@ -216,6 +216,7 @@ class Jira:
|
|
|
216
216
|
assignee: Optional[str] = None,
|
|
217
217
|
labels: Optional[list] = None,
|
|
218
218
|
priority: Optional[str] = None,
|
|
219
|
+
team: Optional[str] = None,
|
|
219
220
|
) -> str:
|
|
220
221
|
"""Generates the issue body payload for creating a new issue.
|
|
221
222
|
|
|
@@ -226,6 +227,7 @@ class Jira:
|
|
|
226
227
|
issue_type (str): The type of the issue.
|
|
227
228
|
labels (list, optional): The labels of the issue. Defaults to None.
|
|
228
229
|
priority (str, optional): The priority of the issue. Defaults to None.
|
|
230
|
+
team (str, optional): The team to be assigned to the Jira issue. Defaults to None.
|
|
229
231
|
|
|
230
232
|
Returns:
|
|
231
233
|
The JSON payload for creating a new issue.
|
|
@@ -246,6 +248,8 @@ class Jira:
|
|
|
246
248
|
fields["fields"]["customfield_10077"] = [CONFIG.ADMIN_CODE]
|
|
247
249
|
if priority:
|
|
248
250
|
fields["fields"]["priority"] = {"id": priority}
|
|
251
|
+
if team:
|
|
252
|
+
fields["fields"]["customfield_10001"] = team
|
|
249
253
|
payload = json.dumps(fields)
|
|
250
254
|
return payload
|
|
251
255
|
|
|
@@ -1146,6 +1150,7 @@ class Jira:
|
|
|
1146
1150
|
attachments: Optional[List] = None,
|
|
1147
1151
|
labels: Optional[list] = None,
|
|
1148
1152
|
priority: Optional[str] = None,
|
|
1153
|
+
team: Optional[str] = None,
|
|
1149
1154
|
) -> requests.Response:
|
|
1150
1155
|
"""Create a new ticket.
|
|
1151
1156
|
|
|
@@ -1156,6 +1161,7 @@ class Jira:
|
|
|
1156
1161
|
attachments (List, optional): The list of attachments. Defaults to None.
|
|
1157
1162
|
labels (List, optional): The list of labels. Defaults to None.
|
|
1158
1163
|
priority (str, optional): The priority of the ticket. Defaults to None.
|
|
1164
|
+
team (str, optional): The team to be assigned to the Jira issue. Defaults to None.
|
|
1159
1165
|
|
|
1160
1166
|
Returns:
|
|
1161
1167
|
The response from creating the ticket.
|
|
@@ -1185,6 +1191,7 @@ class Jira:
|
|
|
1185
1191
|
"project_key": project_key,
|
|
1186
1192
|
"labels": labels,
|
|
1187
1193
|
"priority": priority,
|
|
1194
|
+
"team": team,
|
|
1188
1195
|
}
|
|
1189
1196
|
|
|
1190
1197
|
issue = self.__generate_issue_body(**issue_body)
|
|
@@ -1270,6 +1277,7 @@ class Jira:
|
|
|
1270
1277
|
self,
|
|
1271
1278
|
exception: Optional[Exception] = None,
|
|
1272
1279
|
assignee: Optional[str] = None,
|
|
1280
|
+
team: Optional[str] = None,
|
|
1273
1281
|
attachments: Union[List, str, Path, None] = None,
|
|
1274
1282
|
stack_trace: Optional[str] = None,
|
|
1275
1283
|
metadata: Optional[dict] = None,
|
|
@@ -1280,6 +1288,7 @@ class Jira:
|
|
|
1280
1288
|
Args:
|
|
1281
1289
|
exception (Exception, optional): The exception to be added to the Jira issue.
|
|
1282
1290
|
assignee (str, optional): The assignee to be added to the Jira issue.
|
|
1291
|
+
team (str, optional): The team to be assigned to the Jira issue. Defaults to None.
|
|
1283
1292
|
attachments (List, optional): List of attachments to be added to the Jira issue.
|
|
1284
1293
|
stack_trace (str, optional): Stack trace to be added to the Jira issue.
|
|
1285
1294
|
metadata (dict, optional): Metadata to be added to the Jira issue.
|
|
@@ -1357,6 +1366,7 @@ class Jira:
|
|
|
1357
1366
|
attachments=attachments,
|
|
1358
1367
|
labels=["bug_catcher"],
|
|
1359
1368
|
priority=priority,
|
|
1369
|
+
team=team,
|
|
1360
1370
|
)
|
|
1361
1371
|
if stack_trace and os.path.exists(stack_trace):
|
|
1362
1372
|
os.remove(stack_trace)
|
|
@@ -1635,7 +1645,8 @@ class Jira:
|
|
|
1635
1645
|
exception_chain = "-".join([f"{frame.name}" for frame in frames])
|
|
1636
1646
|
rel_path = os.path.relpath(frames[-1].filename, os.getcwd())
|
|
1637
1647
|
path = Path(os.path.splitext(rel_path)[0]).as_posix()
|
|
1638
|
-
|
|
1648
|
+
path = remove_holotree_id(path)
|
|
1649
|
+
error_id = f"{path}-{exception_chain}-{frames[-1].line}-{exc_type.__module__}-{exc_type.__name__}"
|
|
1639
1650
|
return hashlib.md5(error_id.encode()).hexdigest()
|
|
1640
1651
|
|
|
1641
1652
|
@staticmethod
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
import json
|
|
3
3
|
import os
|
|
4
|
+
import re
|
|
4
5
|
import traceback
|
|
5
6
|
import urllib
|
|
6
7
|
from datetime import date, datetime
|
|
@@ -101,6 +102,19 @@ def strip_path(path: str):
|
|
|
101
102
|
return path.replace(os.getcwd(), "").strip(os.sep)
|
|
102
103
|
|
|
103
104
|
|
|
105
|
+
def remove_holotree_id(path: str) -> str:
|
|
106
|
+
"""A function to remove the value after 'holotree' from the path.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
path (str): The path from which to remove the value after 'holotree'.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
str: The modified path.
|
|
113
|
+
"""
|
|
114
|
+
pattern = r"(holotree\/)[^\/]+\/"
|
|
115
|
+
return re.sub(pattern, r"\1", path)
|
|
116
|
+
|
|
117
|
+
|
|
104
118
|
def retrieve_build_info():
|
|
105
119
|
"""Logs build information."""
|
|
106
120
|
if not os.path.exists(CONFIG.BUILD_INFO_FILE):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|