|
@@ -290,7 +290,27 @@ def logs_tts_count(tts_channel, tts_status):
|
|
|
else:
|
|
|
if res.body:
|
|
|
return res.body
|
|
|
+def logs_tts_ratio(tts_channel, tts_status):
|
|
|
+ endpoint = 'cn-hangzhou.log.aliyuncs.com'
|
|
|
+ accessKeyId = 'LTAIWYUujJAm7CbH'
|
|
|
+ accessKey = 'RfSjdiWwED1sGFlsjXv0DlfTnZTG1P'
|
|
|
+ client = LogClient(endpoint, accessKeyId, accessKey)
|
|
|
+ project = 'wqsd-monitor'
|
|
|
+ logstore = 'monitor-log'
|
|
|
|
|
|
+ topic = ""
|
|
|
+ end_time = int(time.time())
|
|
|
+ start_time = end_time - 300
|
|
|
+ print(start_time, end_time)
|
|
|
+ req = GetLogsRequest(project, logstore, start_time, end_time, topic,
|
|
|
+ "* and __topic__: producetts and channel:{} and produceStatus:{}| select channel,produceStatus,count(*) as count group by channel,produceStatus".format(tts_channel, tts_status) , 30, 0, False)
|
|
|
+ try:
|
|
|
+ res = client.get_logs(req)
|
|
|
+ except Exception as e:
|
|
|
+ avgs = 0
|
|
|
+ else:
|
|
|
+ if res.body:
|
|
|
+ return res.body
|
|
|
|
|
|
|
|
|
def count_recommend_null():
|
|
@@ -618,3 +638,5 @@ def produce_video_ratio_cnt():
|
|
|
|
|
|
|
|
|
# if __name__ == '__main__':
|
|
|
+# res = logs_tts_ratio("aliyun",1)
|
|
|
+# print(res)
|