panwang %!s(int64=3) %!d(string=hai) anos
pai
achega
3791618d7d
Modificáronse 2 ficheiros con 19 adicións e 3 borrados
  1. BIN=BIN
      __pycache__/app.cpython-37.pyc
  2. 19 3
      app.py

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


+ 19 - 3
app.py

@@ -188,13 +188,13 @@ def all_metric():
     end_time = int(datetime.datetime.fromtimestamp(time_stamp).strftime('%Y%m%d%H%M%S')) * 1000000000
     start_time = int(datetime.datetime.fromtimestamp(time_stamp-300).strftime('%Y%m%d%H%M%S')) * 1000000000
     print(start_time, end_time)
-    query_sql = ("select totalCount , (successCount+processingCount1), round((successCount + processingCount1)/totalCount * 100,2), processingCount1 from  "
+    query_sql = ("select totalCount , (successCount+processingCount1), round((successCount + processingCount1)/totalCount * 100,2), processingCount ,processingCount1, processingCount2 from  "
                 "(select count(*) as totalCount,"
                  "sum(case when produce_status in (5,6,7,8) then 1 else 0 end) as successCount,"
                  "sum(case when produce_status = 99 then 1 else 0 end) as failCount , "
                  "sum(case when produce_status in(0,1,2,3,4) then 1 else 0 end) as processingCount,"
-                 "sum(case when produce_status in(0,1,2,3,4) and (rate < 0.7 or rate is null) then 1 else 0 end) processingCount1,"
-                 "sum(case when produce_status in(0,1,2,3,4) and rate >= 0.7 then 1 else 0 end) processingCount2  from  "
+                 "sum(case when produce_status in(0,1,2,3,4) and (rate < 0.7 or rate is null) then 1 else 0 end)   processingCount1,"
+                 "sum(case when produce_status in(0,1,2,3,4) and rate >= 0.7 then 1 else 0 end)  processingCount2  from  "
                  "(select t1.project_id, t1.produce_status, round((t2.last_connect_timestamp - t1.submit_timestamp) / (t1.video_duration/1000), 1) as rate  from produce_video_project t1  "
                  "left join produce_video_project_connect_time t2 on t1.project_id = t2.project_id "
                  "where t1.project_id > %s and t1.project_id < %s and t1.app_type not in (1,13,15)) s1) ss1" %(start_time ,end_time)
@@ -220,10 +220,26 @@ def all_metric():
     else:
         process_cnt = 0
 
+    if res[4]  is not None:
+        process_cnt_1 = res[4]
+    else:
+        process_cnt_1 = 0
+
+    if res[5]  is not None:
+        process_cnt_2 = res[5]
+    else:
+        process_cnt_2 = 0
+
+
     produce_video_task_rate.labels("produce_video_task_rate").set(rate)
     produce_video_task_total.labels('total_cnt').set(total_cnt)
     produce_video_task_sucess.labels('success_cnt').set(success_cnt)
     produce_video_task_count.labels('process_cnt').set(process_cnt)
+    produce_video_task_count.labels('process_cnt<0.7').set(process_cnt_1)
+    produce_video_task_count.labels('process_cnt>0.7').set(process_cnt_2)
+
+
+