修正constants ALERT_PUSH_URL未正确引入bug
This commit is contained in:
@@ -11,7 +11,7 @@ import requests
|
|||||||
from typing import Dict, Any, Callable
|
from typing import Dict, Any, Callable
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
from common.constants import ALERT_PUSH_URL
|
from common import constants
|
||||||
from utils.logger import get_logger
|
from utils.logger import get_logger
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
@@ -78,7 +78,7 @@ class BaseFrameProcessorWorker(threading.Thread):
|
|||||||
def _post_alert(self, msg: dict):
|
def _post_alert(self, msg: dict):
|
||||||
"""异步发送告警 POST 请求(在线程池中执行)"""
|
"""异步发送告警 POST 请求(在线程池中执行)"""
|
||||||
try:
|
try:
|
||||||
response = requests.post(ALERT_PUSH_URL, json=msg, timeout=5.0)
|
response = requests.post(constants.ALERT_PUSH_URL, json=msg, timeout=5.0)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
print(f"[INFO] POST alert sent successfully for actions: {msg.get('result_type')}")
|
print(f"[INFO] POST alert sent successfully for actions: {msg.get('result_type')}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user