mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[BugFix] fix work metrics not returned by metrics api (#4920)
This commit is contained in:
@@ -17,11 +17,20 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
# suppress warning log from paddlepaddle
|
||||
os.environ["GLOG_minloglevel"] = "2"
|
||||
# suppress log from aistudio
|
||||
os.environ["AISTUDIO_LOG"] = "critical"
|
||||
# set prometheus dir
|
||||
if os.getenv("PROMETHEUS_MULTIPROC_DIR", "") == "":
|
||||
prom_dir = f"/tmp/fd_prom_{str(uuid.uuid4())}"
|
||||
os.environ["PROMETHEUS_MULTIPROC_DIR"] = prom_dir
|
||||
if os.path.exists(prom_dir):
|
||||
os.rmdir(prom_dir)
|
||||
os.mkdir(prom_dir)
|
||||
|
||||
import typing
|
||||
|
||||
from paddleformers.utils.log import logger as pf_logger
|
||||
|
||||
@@ -60,7 +60,6 @@ from fastdeploy.entrypoints.openai.utils import UVICORN_CONFIG, make_arg_parser
|
||||
from fastdeploy.envs import environment_variables
|
||||
from fastdeploy.metrics.metrics import (
|
||||
EXCLUDE_LABELS,
|
||||
cleanup_prometheus_files,
|
||||
get_filtered_metrics,
|
||||
main_process_metrics,
|
||||
)
|
||||
@@ -586,8 +585,9 @@ def launch_metrics_server():
|
||||
if not is_port_available(args.host, args.metrics_port):
|
||||
raise Exception(f"The parameter `metrics_port`:{args.metrics_port} is already in use.")
|
||||
|
||||
prom_dir = cleanup_prometheus_files(True)
|
||||
os.environ["PROMETHEUS_MULTIPROC_DIR"] = prom_dir
|
||||
# Move setting prometheus directory to fastdeploy/__init__.py
|
||||
# prom_dir = cleanup_prometheus_files(True)
|
||||
# os.environ["PROMETHEUS_MULTIPROC_DIR"] = prom_dir
|
||||
metrics_server_thread = threading.Thread(target=run_metrics_server, daemon=True)
|
||||
metrics_server_thread.start()
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user