|
@@ -194,7 +194,7 @@ def all_metric():
|
|
# produce_video_task_rate.labels("produce_video_task_rate").set(0)
|
|
# produce_video_task_rate.labels("produce_video_task_rate").set(0)
|
|
start_time = int(time.strftime("%Y%m%d%H%M", time.localtime())) * 100000000000
|
|
start_time = int(time.strftime("%Y%m%d%H%M", time.localtime())) * 100000000000
|
|
end_time = (int(time.strftime("%Y%m%d%H%M", time.localtime())) + 5) * 100000000000
|
|
end_time = (int(time.strftime("%Y%m%d%H%M", time.localtime())) + 5) * 100000000000
|
|
- sql = "select round(successCount/totalCount * 100,2) as 成功率 from (select count(*) as totalCount, sum(case when produce_status != 99 then 1 else 0 end) as successCount from produce_video_project where project_id > {} and project_id < {} and app_type not in (13,15)) t1".format(start_time, end_time)
|
|
|
|
|
|
+ sql = "".format(start_time, end_time)
|
|
res = db_query(sql)
|
|
res = db_query(sql)
|
|
if res[0] is not None:
|
|
if res[0] is not None:
|
|
produce_video_task_rate.labels("produce_video_task_rate").set(res[0])
|
|
produce_video_task_rate.labels("produce_video_task_rate").set(res[0])
|
|
@@ -288,13 +288,18 @@ def all_metric():
|
|
return Response(generate_latest(registry), mimetype="text/plain")
|
|
return Response(generate_latest(registry), mimetype="text/plain")
|
|
@app.route('/qps_avgtime/metrics')
|
|
@app.route('/qps_avgtime/metrics')
|
|
def qps_avgtime_metrics():
|
|
def qps_avgtime_metrics():
|
|
|
|
+ res, url = app_openapi_qps_avgtime_count()
|
|
|
|
+ qps = int(res.body[0]["cnt"])
|
|
|
|
+ avgtime = int(float(res.body[0]["avg_time"]))
|
|
|
|
+ app_type_temp = 1
|
|
|
|
+ url_http_qps.labels(app_type_temp, url).set(qps)
|
|
|
|
+ url_http_avgtime.labels(app_type_temp, url).set(avgtime)
|
|
app_type = ['1', '0', '4', '5', '6', '12', '13']
|
|
app_type = ['1', '0', '4', '5', '6', '12', '13']
|
|
for i in range(len(app_type)):
|
|
for i in range(len(app_type)):
|
|
appType = app_type[i]
|
|
appType = app_type[i]
|
|
res = count_qps_avgtime(appType)
|
|
res = count_qps_avgtime(appType)
|
|
for i in range(len(res.body)):
|
|
for i in range(len(res.body)):
|
|
url = res.body[i]["requestUri"]
|
|
url = res.body[i]["requestUri"]
|
|
-
|
|
|
|
qps = int(res.body[i]["cnt"])
|
|
qps = int(res.body[i]["cnt"])
|
|
avgtime = int(float(res.body[i]["avg_time"]))
|
|
avgtime = int(float(res.body[i]["avg_time"]))
|
|
url_http_qps.labels(appType, url).set(qps)
|
|
url_http_qps.labels(appType, url).set(qps)
|
|
@@ -324,6 +329,8 @@ def qps_avgtime_metrics():
|
|
count = res.body[i]["cnt"]
|
|
count = res.body[i]["cnt"]
|
|
url_http_expendtime_summary.labels(appType, url, ">1000").set(count)
|
|
url_http_expendtime_summary.labels(appType, url, ">1000").set(count)
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
return Response(generate_latest(registry), mimetype="text/plain")
|
|
return Response(generate_latest(registry), mimetype="text/plain")
|
|
|
|
|
|
|
|
|