sycommon-python-lib 0.1.56b6__py3-none-any.whl → 0.1.56b8__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.
- sycommon/config/Config.py +17 -3
- sycommon/config/SentryConfig.py +13 -0
- sycommon/logging/kafka_log.py +185 -432
- sycommon/middleware/exception.py +10 -16
- sycommon/middleware/timeout.py +2 -1
- sycommon/middleware/traceid.py +67 -61
- sycommon/notice/uvicorn_monitor.py +32 -27
- sycommon/rabbitmq/rabbitmq_service.py +25 -854
- sycommon/rabbitmq/rabbitmq_service_client_manager.py +212 -0
- sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +73 -0
- sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +283 -0
- sycommon/rabbitmq/rabbitmq_service_core.py +117 -0
- sycommon/rabbitmq/rabbitmq_service_producer_manager.py +235 -0
- sycommon/sentry/__init__.py +0 -0
- sycommon/sentry/sy_sentry.py +34 -0
- sycommon/services.py +4 -0
- sycommon/synacos/nacos_client_base.py +119 -0
- sycommon/synacos/nacos_config_manager.py +106 -0
- sycommon/synacos/nacos_heartbeat_manager.py +142 -0
- sycommon/synacos/nacos_service.py +59 -780
- sycommon/synacos/nacos_service_discovery.py +138 -0
- sycommon/synacos/nacos_service_registration.py +252 -0
- {sycommon_python_lib-0.1.56b6.dist-info → sycommon_python_lib-0.1.56b8.dist-info}/METADATA +2 -1
- {sycommon_python_lib-0.1.56b6.dist-info → sycommon_python_lib-0.1.56b8.dist-info}/RECORD +27 -14
- {sycommon_python_lib-0.1.56b6.dist-info → sycommon_python_lib-0.1.56b8.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.1.56b6.dist-info → sycommon_python_lib-0.1.56b8.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.1.56b6.dist-info → sycommon_python_lib-0.1.56b8.dist-info}/top_level.txt +0 -0
sycommon/config/Config.py
CHANGED
|
@@ -15,13 +15,12 @@ class Config(metaclass=SingletonMeta):
|
|
|
15
15
|
with open(config_file, 'r', encoding='utf-8') as f:
|
|
16
16
|
self.config = yaml.safe_load(f)
|
|
17
17
|
self.MaxBytes = self.config.get('MaxBytes', 209715200)
|
|
18
|
-
self.Timeout = self.config.get('Timeout',
|
|
18
|
+
self.Timeout = self.config.get('Timeout', 600000)
|
|
19
19
|
self.MaxRetries = self.config.get('MaxRetries', 3)
|
|
20
|
-
self.OCR = self.config.get('OCR', None)
|
|
21
|
-
self.INVOICE_OCR = self.config.get('INVOICE_OCR', None)
|
|
22
20
|
self.llm_configs = []
|
|
23
21
|
self.embedding_configs = []
|
|
24
22
|
self.reranker_configs = []
|
|
23
|
+
self.sentry_configs = []
|
|
25
24
|
self._process_config()
|
|
26
25
|
|
|
27
26
|
def get_llm_config(self, model_name):
|
|
@@ -42,6 +41,12 @@ class Config(metaclass=SingletonMeta):
|
|
|
42
41
|
return llm
|
|
43
42
|
raise ValueError(f"No configuration found for model: {model_name}")
|
|
44
43
|
|
|
44
|
+
def get_sentry_config(self, name):
|
|
45
|
+
for sentry in self.sentry_configs:
|
|
46
|
+
if sentry.get('name') == name:
|
|
47
|
+
return sentry
|
|
48
|
+
raise ValueError(f"No configuration found for server: {name}")
|
|
49
|
+
|
|
45
50
|
def _process_config(self):
|
|
46
51
|
llm_config_list = self.config.get('LLMConfig', [])
|
|
47
52
|
for llm_config in llm_config_list:
|
|
@@ -71,6 +76,15 @@ class Config(metaclass=SingletonMeta):
|
|
|
71
76
|
except ValueError as e:
|
|
72
77
|
print(f"Invalid LLM configuration: {e}")
|
|
73
78
|
|
|
79
|
+
sentry_config_list = self.config.get('SentryConfig', [])
|
|
80
|
+
for sentry_config in sentry_config_list:
|
|
81
|
+
try:
|
|
82
|
+
from sycommon.config.SentryConfig import SentryConfig
|
|
83
|
+
validated_config = SentryConfig(**sentry_config)
|
|
84
|
+
self.sentry_configs.append(validated_config.model_dump())
|
|
85
|
+
except ValueError as e:
|
|
86
|
+
print(f"Invalid Sentry configuration: {e}")
|
|
87
|
+
|
|
74
88
|
def set_attr(self, share_configs: dict):
|
|
75
89
|
self.config = {**self.config, **
|
|
76
90
|
share_configs.get('llm', {}), **share_configs}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SentryConfig(BaseModel):
|
|
5
|
+
name: str
|
|
6
|
+
dsn: str
|
|
7
|
+
enable: bool
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def from_config(cls, server_name: str):
|
|
11
|
+
from sycommon.config.Config import Config
|
|
12
|
+
sentry_config = Config().get_sentry_config(server_name)
|
|
13
|
+
return cls(**sentry_config)
|