t-bug-catcher 0.5.9__tar.gz → 0.6.0__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.
Files changed (26) hide show
  1. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/PKG-INFO +1 -1
  2. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/setup.cfg +1 -1
  3. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/setup.py +1 -1
  4. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/__init__.py +1 -1
  5. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/jira.py +28 -24
  6. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/PKG-INFO +1 -1
  7. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/MANIFEST.in +0 -0
  8. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/README.rst +0 -0
  9. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/pyproject.toml +0 -0
  10. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/requirements.txt +0 -0
  11. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/bug_catcher.py +0 -0
  12. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/bug_snag.py +0 -0
  13. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/config.py +0 -0
  14. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/exceptions.py +0 -0
  15. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/resources/whispers_config.yml +0 -0
  16. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/stack_saver.py +0 -0
  17. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/utils/__init__.py +0 -0
  18. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/utils/common.py +0 -0
  19. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/utils/logger.py +0 -0
  20. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher/workitems.py +0 -0
  21. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
  22. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
  23. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/not-zip-safe +0 -0
  24. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/requires.txt +0 -0
  25. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/t_bug_catcher.egg-info/top_level.txt +0 -0
  26. {t_bug_catcher-0.5.9 → t_bug_catcher-0.6.0}/tests/test_t_bug_catcher.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.5.9
3
+ Version: 0.6.0
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.5.9
2
+ current_version = 0.6.0
3
3
  commit = True
4
4
  tag = False
5
5
 
@@ -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.5.9",
29
+ version="0.6.0",
30
30
  zip_safe=False,
31
31
  install_requires=install_requirements,
32
32
  include_package_data=True,
@@ -3,7 +3,7 @@
3
3
  __author__ = """Thoughtful"""
4
4
  __email__ = "support@thoughtful.ai"
5
5
  # fmt: off
6
- __version__ = '0.5.9'
6
+ __version__ = '0.6.0'
7
7
  # fmt: on
8
8
 
9
9
  from .bug_catcher import (
@@ -15,6 +15,7 @@ from typing import List, Optional, Union
15
15
 
16
16
  import requests
17
17
  from requests.auth import HTTPBasicAuth
18
+ from requests.exceptions import ChunkedEncodingError
18
19
  from retry import retry
19
20
 
20
21
  from .config import CONFIG
@@ -29,11 +30,11 @@ def retry_if_bad_request(func):
29
30
  attempt = 1
30
31
  tries = 3
31
32
 
32
- @retry(exceptions=BadRequestError, tries=tries, delay=1, backoff=2)
33
+ @retry(exceptions=(BadRequestError, ChunkedEncodingError), tries=tries, delay=1, backoff=2)
33
34
  def wrapper(*args, **kwargs):
34
35
  try:
35
36
  return func(*args, **kwargs)
36
- except BadRequestError as ex:
37
+ except (BadRequestError, ChunkedEncodingError) as ex:
37
38
  nonlocal attempt
38
39
  attempt = attempt + 1 if attempt < tries else 1
39
40
  raise ex
@@ -1120,6 +1121,12 @@ class Jira:
1120
1121
  else []
1121
1122
  )
1122
1123
 
1124
+ if len(issue.get("fields", {}).get("comment", [])) >= 5000:
1125
+ logger.warning(
1126
+ f"Comments for '{issue.get('key')}' were not posted due to exceeding JIRA comments limit (5000)."
1127
+ )
1128
+ return
1129
+
1123
1130
  self.update_comment(
1124
1131
  ticket_id=issue["id"],
1125
1132
  comments=self.__create_comment_markup(
@@ -1170,26 +1177,25 @@ class Jira:
1170
1177
  or self._issue_types.get("epic")
1171
1178
  )
1172
1179
 
1173
- issue = self.__generate_issue_body(
1174
- summary=summary[:255].split("\n")[0],
1175
- description=description,
1176
- assignee=assignee_id,
1177
- issue_type=issue_type,
1178
- project_key=project_key,
1179
- labels=labels,
1180
- priority=priority,
1181
- )
1180
+ issue_body = {
1181
+ "summary": summary[:255].split("\n")[0],
1182
+ "description": description,
1183
+ "assignee": assignee_id,
1184
+ "issue_type": issue_type,
1185
+ "project_key": project_key,
1186
+ "labels": labels,
1187
+ "priority": priority,
1188
+ }
1189
+
1190
+ issue = self.__generate_issue_body(**issue_body)
1191
+
1182
1192
  response = self.post_ticket(issue=issue)
1183
1193
 
1184
- if response.json().get("errors", {}).get("labels"):
1185
- issue = self.__generate_issue_body(
1186
- summary=summary[:255].split("\n")[0],
1187
- description=description,
1188
- assignee=assignee_id,
1189
- issue_type=issue_type,
1190
- project_key=project_key,
1191
- priority=priority,
1192
- )
1194
+ errors = response.json().get("errors", {})
1195
+
1196
+ if errors:
1197
+ issue_body = {key: value for key, value in issue_body.items() if key not in errors}
1198
+ issue = self.__generate_issue_body(**issue_body)
1193
1199
  response = self.post_ticket(issue=issue)
1194
1200
 
1195
1201
  if response.status_code != 201:
@@ -1342,7 +1348,7 @@ class Jira:
1342
1348
  metadata=metadata,
1343
1349
  )
1344
1350
 
1345
- priority = CONFIG.TICKET_PRIORITIES.HIGH if CONFIG.STAGE and CONFIG.STAGE.lower() == "hypercare" else None
1351
+ priority = CONFIG.TICKET_PRIORITIES.HIGH
1346
1352
 
1347
1353
  response = self.__create_new_ticket(
1348
1354
  summary=summary,
@@ -1405,9 +1411,7 @@ class Jira:
1405
1411
  error_id=error_id,
1406
1412
  )
1407
1413
 
1408
- priority = (
1409
- CONFIG.TICKET_PRIORITIES.HIGHEST if CONFIG.STAGE and CONFIG.STAGE.lower() == "hypercare" else None
1410
- )
1414
+ priority = CONFIG.TICKET_PRIORITIES.HIGHEST
1411
1415
 
1412
1416
  response = self.__create_new_ticket(
1413
1417
  summary=summary,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.5.9
3
+ Version: 0.6.0
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
File without changes
File without changes