Browse Source

add skywalking

liqian 3 năm trước cách đây
mục cha
commit
5084bc7438
2 tập tin đã thay đổi với 16 bổ sung8 xóa
  1. 11 4
      app.py
  2. 5 4
      requirements.txt

+ 11 - 4
app.py

@@ -1,6 +1,3 @@
-from gevent import monkey
-monkey.patch_all()
-
 import json
 import time
 
@@ -16,7 +13,17 @@ import ast
 from gevent.pywsgi import WSGIServer
 from multiprocessing import cpu_count, Process
 from utils import update_video_w_h_rate
-#from werkzeug.middleware.profiler import ProfilerMiddleware
+# from werkzeug.middleware.profiler import ProfilerMiddleware
+from gevent import monkey
+
+# 导入skywalking链路监控
+from skywalking import agent, config
+config.init(collector='skywalking.piaoquantv.com:11800', service='rov-server')
+config.flask_collect_http_params = True
+agent.start()
+
+monkey.patch_all()
+
 app = Flask(__name__)
 #app.wsgi_app = ProfilerMiddleware(app.wsgi_app)
 log_ = Log()

+ 5 - 4
requirements.txt

@@ -1,8 +1,9 @@
+numpy==1.19.2
+requests==2.24.0
 PyMySQL==1.0.2
+apache_skywalking==0.7.0
+Flask==1.1.2
 gevent==20.9.0
 redis==3.5.3
-requests==2.24.0
 psycopg2_binary==2.9.1
-numpy==1.19.2
-Flask==1.1.2
-psycopg2==2.9.2
+psycopg2==2.9.3