atk-common 3.6.0__py3-none-any.whl → 3.8.0__py3-none-any.whl
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.
- atk_common/classes/bo_logger.py +4 -9
- atk_common/classes/docker_handler.py +4 -1
- atk_common/classes/error_handler.py +1 -1
- atk_common/interfaces/docker_handler_interface.py +1 -0
- atk_common/interfaces/logger_interface.py +2 -1
- atk_common/utils/__init__.py +2 -0
- atk_common/utils/str_utils.py +7 -0
- {atk_common-3.6.0.dist-info → atk_common-3.8.0.dist-info}/METADATA +1 -1
- {atk_common-3.6.0.dist-info → atk_common-3.8.0.dist-info}/RECORD +12 -11
- {atk_common-3.6.0.dist-info → atk_common-3.8.0.dist-info}/WHEEL +0 -0
- {atk_common-3.6.0.dist-info → atk_common-3.8.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-3.6.0.dist-info → atk_common-3.8.0.dist-info}/top_level.txt +0 -0
atk_common/classes/bo_logger.py
CHANGED
@@ -4,6 +4,7 @@ from opentelemetry.trace import get_current_span
|
|
4
4
|
from atk_common.interfaces import ILogger
|
5
5
|
from atk_common.enums import LogLevel
|
6
6
|
from atk_common.utils.datetime_utils import get_utc_iso_date_time
|
7
|
+
from atk_common.utils.str_utils import parse_component_name
|
7
8
|
|
8
9
|
class BoLogger(ILogger):
|
9
10
|
def __init__(self, log_level: LogLevel, component, version):
|
@@ -11,17 +12,9 @@ class BoLogger(ILogger):
|
|
11
12
|
self.log_level = LogLevel.INFO
|
12
13
|
else:
|
13
14
|
self.log_level = log_level
|
14
|
-
self.component =
|
15
|
+
self.component = parse_component_name(component)
|
15
16
|
self.version = version
|
16
17
|
|
17
|
-
# Example: ghcr.io/perspictech/bo-status-mq-consumer
|
18
|
-
def _parse_component_name(self, component: str) -> str:
|
19
|
-
if component.startswith("ghcr"):
|
20
|
-
parts = component.split('/')
|
21
|
-
if len(parts) == 3:
|
22
|
-
return parts[2]
|
23
|
-
return component
|
24
|
-
|
25
18
|
def _get_trace_context(self):
|
26
19
|
span = get_current_span()
|
27
20
|
ctx = span.get_span_context()
|
@@ -64,3 +57,5 @@ class BoLogger(ILogger):
|
|
64
57
|
def set_level(self, log_level: LogLevel):
|
65
58
|
self.log_level = log_level
|
66
59
|
|
60
|
+
def get_level(self):
|
61
|
+
return self.log_level
|
@@ -8,7 +8,7 @@ class DockerHandler(IDockerHandler):
|
|
8
8
|
self.logger = logger
|
9
9
|
self.image_name = image_name
|
10
10
|
self.image_version = image_version
|
11
|
-
self.set_container_metadata()
|
11
|
+
self.container_data = self.set_container_metadata()
|
12
12
|
|
13
13
|
def get_image_name_and_version(self, tags):
|
14
14
|
if tags:
|
@@ -74,3 +74,6 @@ class DockerHandler(IDockerHandler):
|
|
74
74
|
data['containerName'] = self.image_name
|
75
75
|
self.create_container_log(data)
|
76
76
|
return data
|
77
|
+
|
78
|
+
def get_container_metadata(self):
|
79
|
+
return self.container_data
|
@@ -42,7 +42,7 @@ class ErrorHandler(IErrorHandler):
|
|
42
42
|
data['message'] = self.get_message(error)
|
43
43
|
data['method'] = method
|
44
44
|
data['timestamp'] = get_utc_date_time_str()
|
45
|
-
data['containerInfo'] = self.docker_handler.
|
45
|
+
data['containerInfo'] = self.docker_handler.get_container_metadata()
|
46
46
|
self.create_error_log(data)
|
47
47
|
return Response(
|
48
48
|
response=json.dumps(data),
|
@@ -8,4 +8,5 @@ class ILogger(Protocol):
|
|
8
8
|
def info(self, msg: str) -> None: ...
|
9
9
|
def warning(self, msg: str) -> None: ...
|
10
10
|
def error(self, msg: str) -> None: ...
|
11
|
-
def set_level(self, log_level: LogLevel) -> None: ...
|
11
|
+
def set_level(self, log_level: LogLevel) -> None: ...
|
12
|
+
def get_level(self) -> LogLevel: ...
|
atk_common/utils/__init__.py
CHANGED
@@ -18,6 +18,7 @@ from atk_common.utils.http_utils import is_http_status_ok, is_http_status_intern
|
|
18
18
|
from atk_common.utils.internal_response_utils import create_response, is_response_ok, is_response_http, is_response_internal
|
19
19
|
from atk_common.utils.file_utils import get_image_file_type
|
20
20
|
from atk_common.utils.mq_utils import decode_message
|
21
|
+
from atk_common.utils.str_utils import parse_component_name
|
21
22
|
|
22
23
|
__all__ = [
|
23
24
|
'create_retry_handler',
|
@@ -46,4 +47,5 @@ __all__ = [
|
|
46
47
|
'is_response_internal',
|
47
48
|
'get_image_file_type',
|
48
49
|
'decode_message',
|
50
|
+
'parse_component_name'
|
49
51
|
]
|
@@ -17,10 +17,10 @@ atk_common/mq_utils.py,sha256=6z4l7LsZWCzldsCZPsWnCtN4lIQ3gyoSuywQoQOh5Ak,1137
|
|
17
17
|
atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
|
18
18
|
atk_common/response_utils.py,sha256=AxlmwkFoDU5XcFOzBQiuZxAQgswihpKXHSo1T0JJw3Q,556
|
19
19
|
atk_common/classes/__init__.py,sha256=O_VHYxAilmoz3i9L6jkwS-JZ4UaTezdhFiA5liNl1lY,532
|
20
|
-
atk_common/classes/bo_logger.py,sha256=
|
21
|
-
atk_common/classes/docker_handler.py,sha256=
|
20
|
+
atk_common/classes/bo_logger.py,sha256=wo1-BNWZjzSnlcM7c0LB7tK__2g3BENXvSvCLEiTOME,2065
|
21
|
+
atk_common/classes/docker_handler.py,sha256=VNJecc2ZWcpwNBa61QTGM_kYrsoZTjktMcFRFGF4xI4,3048
|
22
22
|
atk_common/classes/env_handler.py,sha256=h3snKwHwDvfc2dt1vgHasqv8n_vnsI9J2MAr-XM5oow,1283
|
23
|
-
atk_common/classes/error_handler.py,sha256=
|
23
|
+
atk_common/classes/error_handler.py,sha256=D2oILLc8VeZmd16PuJsjfu7g0Q6kCWazt8FPa3gJamQ,3268
|
24
24
|
atk_common/classes/http_response_handler.py,sha256=l8CfntLPRHbB1nfUPPGnmTvQMAM29CVK4THG4FK1_4k,2128
|
25
25
|
atk_common/classes/rabbitmq_consumer.py,sha256=jct1UnfP-PU3IeWW2S_9dQ7FxmY0_M8YwZadFMv52j8,2936
|
26
26
|
atk_common/enums/__init__.py,sha256=hOSoKWIBUpRFaMN2tNJiel6iGI1MHj229OYnU1J8Jg0,2636
|
@@ -64,12 +64,12 @@ atk_common/enums/speed_control_stop_reason.py,sha256=pvLS6fpDhsCiIDAmiQBsHctxZnq
|
|
64
64
|
atk_common/enums/test_image_type_enum.py,sha256=HUjxJorehnzRXMNF2uHk2DrAJ3Y_ajQvp0jW-mtlOhU,140
|
65
65
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
66
66
|
atk_common/interfaces/__init__.py,sha256=HynEg28Uy3msO7qd__VxajTasSe9-Evpj9yi3Uw2NTo,508
|
67
|
-
atk_common/interfaces/docker_handler_interface.py,sha256=
|
67
|
+
atk_common/interfaces/docker_handler_interface.py,sha256=hs71uNcFvSbTqRvcL4XarHx6DONP1J7MrUUz-oO28bM,458
|
68
68
|
atk_common/interfaces/env_handler_interface.py,sha256=yrmtTplH5tnuOAs7CW5RtzLMTE5q9sdzTYjiS2naNQQ,300
|
69
69
|
atk_common/interfaces/error_handler_interface.py,sha256=ErhQ69T3fCYUl6sS5GwiMgW-znapmGcmgWLR2QLNu8c,506
|
70
70
|
atk_common/interfaces/http_response_handler_interface.py,sha256=QjDmhVj4AnUyoRtSHk_sfFPI-cto6TV7Mx2_87tiOrs,185
|
71
|
-
atk_common/interfaces/logger_interface.py,sha256=
|
72
|
-
atk_common/utils/__init__.py,sha256=
|
71
|
+
atk_common/interfaces/logger_interface.py,sha256=jK1gwkB_XmvqsTENhfOsw2QBplay16yVzc_qDSkgFyk,423
|
72
|
+
atk_common/utils/__init__.py,sha256=hU5xicoI6dXRDz0gQADIDo2YbiL2UptTehVBISReIDo,1857
|
73
73
|
atk_common/utils/consumer_retry_handler.py,sha256=-qnqxA07XLn0KKOGJCuyixqwmWYzM3g8Ii-ei2At3bY,2559
|
74
74
|
atk_common/utils/datetime_utils.py,sha256=h3tv6iPD4peBXLCAcws41nuxIM4KpR1vk71LYXTDHKo,3662
|
75
75
|
atk_common/utils/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
|
@@ -80,7 +80,8 @@ atk_common/utils/hash_utils.py,sha256=S_9o89CdI4lUQbVaqc85TDcqyDNuo30_E3VBaOrZKk
|
|
80
80
|
atk_common/utils/http_utils.py,sha256=eSRuQeDgN0ISQdByZqE6cIGXoorcAXz7PEtVntHUKAo,670
|
81
81
|
atk_common/utils/internal_response_utils.py,sha256=2X9eLFEy1pO3Aesj1IRXg2yprwNcBDM5_dXaA5vfmMI,694
|
82
82
|
atk_common/utils/mq_utils.py,sha256=DmVcXIZHG45p7cQVvgen6OT8QbW_UifFFJGJBybTkJQ,1835
|
83
|
-
atk_common
|
83
|
+
atk_common/utils/str_utils.py,sha256=sg3jwTTIfQvgGP-lcY5Xh4PXXhKWse_4HswBQYQKEo4,260
|
84
|
+
atk_common-3.8.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
84
85
|
atk_package/__init__.py,sha256=okIFEefQhQrw6DZg6oCEVWsEdkVCk-57VXBW0IUG_wU,834
|
85
86
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
86
87
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -93,7 +94,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
93
94
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
94
95
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
95
96
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
|
-
atk_common-3.
|
97
|
-
atk_common-3.
|
98
|
-
atk_common-3.
|
99
|
-
atk_common-3.
|
97
|
+
atk_common-3.8.0.dist-info/METADATA,sha256=og3Q1fsls7xseAr--C-ShEPmkDU7uMPePfr411IkwU4,1760
|
98
|
+
atk_common-3.8.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
99
|
+
atk_common-3.8.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
100
|
+
atk_common-3.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|