Commit fad1116c authored by zhanhuasheng's avatar zhanhuasheng

增加告警

parent 2768ad68
...@@ -141,7 +141,7 @@ class ReqHandler: ...@@ -141,7 +141,7 @@ class ReqHandler:
try: try:
assert res.status_code == 200 #先断言状态码是正确的 assert res.status_code == 200 #先断言状态码是正确的
time = res.elapsed.total_seconds() time = res.elapsed.total_seconds()
if time >= 0.1: if time >= 4:
warnings.warn(f'接口响应时间过长,耗时{time}秒') warnings.warn(f'接口响应时间过长,耗时{time}秒')
logger.error(f'接口响应时间过长,耗时{time}秒') logger.error(f'接口响应时间过长,耗时{time}秒')
if isinstance(expected,list): if isinstance(expected,list):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment