panwang %!s(int64=3) %!d(string=hai) anos
pai
achega
e4fc2bf1c4
Modificáronse 4 ficheiros con 41 adicións e 29 borrados
  1. BIN=BIN
      __pycache__/app.cpython-37.pyc
  2. BIN=BIN
      __pycache__/utils.cpython-37.pyc
  3. 40 29
      app.py
  4. 1 0
      utils.py

BIN=BIN
__pycache__/app.cpython-37.pyc


BIN=BIN
__pycache__/utils.cpython-37.pyc


+ 40 - 29
app.py

@@ -52,7 +52,6 @@ produce_video_task_ratio = Gauge("produce_video_task_ratio", 'produce_video_rati
 
 produce_video_tts_count = Gauge("produce_video_tts_count", 'success', ['tts_channel'], registry=registry)
 produce_video_tts_ratio = Gauge("produce_video_tts_ratio", 'ratio', ['channel'], registry=registry)
-produce_video_tts_count_5m = Gauge("produce_video_tts_count", 'success', ['tts_channel'], registry=registry)
 
 
 
@@ -249,34 +248,46 @@ def all_metric():
         if res[2]:
             fail_cnt = res[2]
             produce_video_task_count.labels("fail").set(fail_cnt)
-        # if res[3]:
-        #     process_cnt = res[3]
-        #     produce_video_task_count.labels("process").set(process_cnt)
-        if res[4]:
-            r1 = res[4]
-            produce_video_task_ratio.labels("<0.5").set(r1)
-        if res[5]:
-            r2 = res[5]
-            produce_video_task_ratio.labels("0.5-0.7").set(r2)
-        if res[5]:
-            r3 = res[6]
-            produce_video_task_ratio.labels("0.7-1.0").set(r3)
-
-        if res[5]:
-            r4 = res[7]
-            produce_video_task_ratio.labels("1.0-1.5").set(r4)
-
-        if res[5]:
-            r5 = res[8]
-            produce_video_task_ratio.labels("1.5-2.0").set(r5)
-
-        if res[5]:
-            r6 = res[9]
-            produce_video_task_ratio.labels(">2.0").set(r6)
-
-
-
-#     sql = "select v1 as 平均合成耗时,v2 as 平均视频时长, round(v2/v1,1) as 时长耗时比 from  (select avg(produce_done_timestamp - submit_timestamp) as v1, avg(video_duration/1000) as v2 from produce_video_project where project_id > {} and project_id < {} and app_type not in (13,15) and produce_status in (5,6,7,8)) as t1".format(start_time, end_time)
+
+    res = produce_video_ratio_cnt()
+
+    if res[1]:
+        r1 = res[1]
+    else:
+        r1 = 0
+    produce_video_task_ratio.labels("<0.5").set(r1)
+
+    if res[2]:
+        r2 = res[2]
+    else:
+        r2 = 0
+    produce_video_task_ratio.labels("0.5-0.7").set(r2)
+
+    if res[3]:
+        r3 = res[3]
+    else:
+        r3 = 0
+    produce_video_task_ratio.labels("0.7-1.0").set(r3)
+
+    if res[4]:
+        r4 = res[4]
+    else:
+        r4 = 0
+    produce_video_task_ratio.labels("1.0-1.5").set(r4)
+
+    if res[5]:
+        r5 = res[5]
+    else:
+        r5 = 0
+    produce_video_task_ratio.labels("1.5-2.0").set(r5)
+
+    if res[6]:
+        r6 = res[6]
+    else:
+        r6 = 0
+    produce_video_task_ratio.labels(">2.0").set(r6)
+
+    #     sql = "select v1 as 平均合成耗时,v2 as 平均视频时长, round(v2/v1,1) as 时长耗时比 from  (select avg(produce_done_timestamp - submit_timestamp) as v1, avg(video_duration/1000) as v2 from produce_video_project where project_id > {} and project_id < {} and app_type not in (13,15) and produce_status in (5,6,7,8)) as t1".format(start_time, end_time)
 # #tts
 #     res = db_query(sql)
 #     if res[2] is not None:

+ 1 - 0
utils.py

@@ -635,6 +635,7 @@ def  produce_video_ratio_cnt():
     cursor.execute(sql)
     conn.commit()
 
+    return  res
 
 
 # if __name__ == '__main__':