|
@@ -26,6 +26,23 @@ def h5_curl():
|
|
|
info = c.getinfo(pycurl.INFO_FILETIME)
|
|
|
|
|
|
print(info)
|
|
|
+def requesl_url_list(apptype):
|
|
|
+ endpoint = 'cn-hangzhou.log.aliyuncs.com'
|
|
|
+ accessKeyId = 'LTAIWYUujJAm7CbH'
|
|
|
+ accessKey = 'RfSjdiWwED1sGFlsjXv0DlfTnZTG1P'
|
|
|
+ logstore = 'request-log'
|
|
|
+ client = LogClient(endpoint, accessKeyId, accessKey)
|
|
|
+ project = 'wqsd-longvideoapi'
|
|
|
+ topic = ""
|
|
|
+ start_time = int(time.time())
|
|
|
+ end_time = start_time - 86400
|
|
|
+ # url = '/longvideoapi/user/idolsUpdated'
|
|
|
+ req = GetLogsRequest(project, logstore, end_time, start_time, topic,
|
|
|
+ "params.appType=%s | select requestUri group by requestUri " %(apptype), 30, 0, False)
|
|
|
+ res = client.get_logs(req)
|
|
|
+
|
|
|
+
|
|
|
+ return res
|
|
|
if __name__ == '__main__':
|
|
|
# with session_maker() as session:
|
|
|
# instance_info = session.query(InstanceList).filter(InstanceList.status==0).all()
|
|
@@ -33,111 +50,111 @@ if __name__ == '__main__':
|
|
|
# print( instance_info[index].ipadd)
|
|
|
|
|
|
requestUri_list = [
|
|
|
- 'longvideoapi/sys/config',
|
|
|
- 'longvideoapi/video/played',
|
|
|
- 'longvideoapi/video/shared/weixin/friend',
|
|
|
- 'longvideoapi/user/login/v2',
|
|
|
- 'longvideoapi/user/info/getUserInfoExt',
|
|
|
- 'longvideoapi/user/token/check',
|
|
|
- 'longvideoapi/user/token/refresh',
|
|
|
- 'longvideoapi/user/info/homepageHead',
|
|
|
- 'longvideoapi/user/share/homepage/circle',
|
|
|
- 'longvideoapi/user/idols',
|
|
|
- 'longvideoapi/user/fans',
|
|
|
- 'longvideoapi/user/recommend/list/v4',
|
|
|
- 'longvideoapi/user/outside/subscribeBatch',
|
|
|
- 'longvideoapi/user/info/getBaseUserInfo',
|
|
|
- 'longvideoapi/user/info/getTargetBaseUserInfo',
|
|
|
- 'longvideoapi/user/getWxUserInfoByCode',
|
|
|
- 'longvideoapi/user/follow',
|
|
|
- 'longvideoapi/user/unfollow',
|
|
|
- 'longvideoapi/video/favorite',
|
|
|
- 'longvideoapi/video/unfavorite',
|
|
|
- 'longvideoapi/video/shared/weixin/circle',
|
|
|
- 'longvideoapi/videoCollection/loadUserVideoCollections',
|
|
|
- 'longvideoapi/video/v2/sharePage/queryVideosByCollectionId',
|
|
|
- 'longvideoapi/video/v2/detailPage/queryVideosByCollectionId',
|
|
|
- 'longvideoapi/videoCollection/loadUserVideoCollectionsForShareOrDetailPage',
|
|
|
- 'longvideoapi/video/distribute/getAppInfo',
|
|
|
- 'longvideoapi/video/distribute/category/videoList/v2',
|
|
|
- 'longvideoapi/video/v2/followed',
|
|
|
- 'longvideoapi/video/v2/loadHotVideosByCollectionId',
|
|
|
- 'longvideoapi/video/v2/loadLatelyVideosByCollectionId',
|
|
|
- 'longvideoapi/video/v2/detail',
|
|
|
- 'longvideoapi/video/v2/sharePageDetail',
|
|
|
- 'longvideoapi/video/send',
|
|
|
- 'longvideoapi/video/getCoverImagePaths',
|
|
|
- 'longvideoapi/video/updateVideo',
|
|
|
- 'longvideoapi/video/deleteVideo',
|
|
|
- 'longvideoapi/video/barrage/send',
|
|
|
- 'longvideoapi/video/barrage/switch',
|
|
|
- 'longvideoapi/video/videoActionReport',
|
|
|
- 'longvideoapi/video/barrage/v2/list',
|
|
|
- 'longvideoapi/video/shared/h5"',
|
|
|
- 'longvideoapi/user/share/report',
|
|
|
- 'longvideoapi/oss/signature',
|
|
|
- 'longvideoapi/oss/completeUpload',
|
|
|
- 'longvideoapi/oss/producevideo/getStsToken',
|
|
|
- 'longvideoapi/operate/message/list',
|
|
|
- 'longvideoapi/video/message/list',
|
|
|
- 'longvideoapi/sys/message/list',
|
|
|
- 'longvideoapi/user/station/message/statistics/info',
|
|
|
- 'longvideoapi/user/station/message/statistics/read',
|
|
|
- 'longvideoapi/user/station/message/totalCount/v2',
|
|
|
- 'longvideoapi/user/station/message/totalRead',
|
|
|
- 'longvideoapi/user/station/notice/list',
|
|
|
- 'longvideoapi/user/station/message/share/list',
|
|
|
- 'longvideoapi/user/station/message/prise/list',
|
|
|
- 'longvideoapi/user/station/message/favorite/list',
|
|
|
- 'longvideoapi/user/station/message/comment/list',
|
|
|
- 'longvideoapi/user/station/message/barrage/list',
|
|
|
- 'longvideoapi/operation/message/list',
|
|
|
- 'longvideoapi/search/userandvideo/list',
|
|
|
- 'longvideoapi/search/tips',
|
|
|
- 'longvideoapi/search/user/list',
|
|
|
- 'longvideoapi/search/video/list',
|
|
|
- 'longvideoapi/search/hot/words',
|
|
|
- 'longvideoapi/search/hot/videos',
|
|
|
- 'longvideoapi/video/distribute/search/recommendVideoes/v2',
|
|
|
- 'longvideoapi/comment/top/save',
|
|
|
- 'longvideoapi/comment/top/page',
|
|
|
- 'longvideoapi/comment/praise',
|
|
|
- 'longvideoapi/comment/second/save',
|
|
|
- 'longvideoapi/comment/second/page',
|
|
|
- 'longvideoapi/comment/delete',
|
|
|
- 'longvideoapi/comment/updelete',
|
|
|
- 'longvideoapi/comment/hots',
|
|
|
- 'longvideoapi/bank/withdraw/getBankWithdrawConfig',
|
|
|
- 'longvideoapi/bank/withdraw/getBankWithdrawRecordList',
|
|
|
- 'longvideoapi/bank/withdraw/wxSamllapp/requestWithdraw',
|
|
|
- 'longvideoapi/purchase/video/list',
|
|
|
- 'longvideoapi/profits/myself/head',
|
|
|
- 'longvideoapi/profits/myself/list',
|
|
|
- 'longvideoapi/profits/myself/recordList/v2',
|
|
|
- 'longvideoapi/profits/reward/recordListAccordingToUser',
|
|
|
- 'longvideoapi/profits/reward/recordListAccordingToVideo',
|
|
|
- 'longvideoapi/video/reward/getVideoRewardHeadInfo',
|
|
|
- 'longvideoapi/video/reward/getVideoRewardRecordList',
|
|
|
- 'longvideoapi/video/reward/getVideoRewardConfig',
|
|
|
- 'longvideoapi/video/reward/getVideoRewardConfig/v2',
|
|
|
- 'longvideoapi/order/updateClientPayStatus',
|
|
|
- 'longvideoapi/order/purchase',
|
|
|
- 'longvideoapi/profits/videoPay/head',
|
|
|
- 'longvideoapi/profits/videoPay/list',
|
|
|
- 'longvideoapi/video/getPayedVideoPath',
|
|
|
- 'longvideoapi/order/reward',
|
|
|
- 'longvideoapi/video/reward/getVideoDetailRewardInfo',
|
|
|
- 'longvideoapi/video/recommend/detailPage/list',
|
|
|
- 'longvideoapi/video/recommend/sharePage/list',
|
|
|
- 'longvideoapi/measure/report/view',
|
|
|
- 'longvideoapi/video/validatePwd"',
|
|
|
- 'longvideoapi/video/validatePwdAuth"',
|
|
|
- 'longvideoapi/video/v2/getCutVideo',
|
|
|
- 'longvideoapi/frontConfig/getWxFrontConfig',
|
|
|
- 'longvideoapi/frontConfig/getVideoPlayConfig',
|
|
|
- 'longvideoapi/frontConfig/getUserFrontConfig',
|
|
|
- 'longvideoapi/rhythmapp/homepage/getAllVideos',
|
|
|
- 'longvideoapi/ad/position/info'
|
|
|
+ '/longvideoapi/sys/config',
|
|
|
+ '/longvideoapi/video/played',
|
|
|
+ '/longvideoapi/video/shared/weixin/friend',
|
|
|
+ '/longvideoapi/user/login/v2',
|
|
|
+ '/longvideoapi/user/info/getUserInfoExt',
|
|
|
+ '/longvideoapi/user/token/check',
|
|
|
+ '/longvideoapi/user/token/refresh',
|
|
|
+ '/longvideoapi/user/info/homepageHead',
|
|
|
+ '/longvideoapi/user/share/homepage/circle',
|
|
|
+ '/longvideoapi/user/idols',
|
|
|
+ '/longvideoapi/user/fans',
|
|
|
+ '/longvideoapi/user/recommend/list/v4',
|
|
|
+ '/longvideoapi/user/outside/subscribeBatch',
|
|
|
+ '/longvideoapi/user/info/getBaseUserInfo',
|
|
|
+ '/longvideoapi/user/info/getTargetBaseUserInfo',
|
|
|
+ '/longvideoapi/user/getWxUserInfoByCode',
|
|
|
+ '/longvideoapi/user/follow',
|
|
|
+ '/longvideoapi/user/unfollow',
|
|
|
+ '/longvideoapi/video/favorite',
|
|
|
+ '/longvideoapi/video/unfavorite',
|
|
|
+ '/longvideoapi/video/shared/weixin/circle',
|
|
|
+ '/longvideoapi/videoCollection/loadUserVideoCollections',
|
|
|
+ '/longvideoapi/video/v2/sharePage/queryVideosByCollectionId',
|
|
|
+ '/longvideoapi/video/v2/detailPage/queryVideosByCollectionId',
|
|
|
+ '/longvideoapi/videoCollection/loadUserVideoCollectionsForShareOrDetailPage',
|
|
|
+ '/longvideoapi/video/distribute/getAppInfo',
|
|
|
+ '/longvideoapi/video/distribute/category/videoList/v2',
|
|
|
+ '/longvideoapi/video/v2/followed',
|
|
|
+ '/longvideoapi/video/v2/loadHotVideosByCollectionId',
|
|
|
+ '/longvideoapi/video/v2/loadLatelyVideosByCollectionId',
|
|
|
+ '/longvideoapi/video/v2/detail',
|
|
|
+ '/longvideoapi/video/v2/sharePageDetail',
|
|
|
+ '/longvideoapi/video/send',
|
|
|
+ '/longvideoapi/video/getCoverImagePaths',
|
|
|
+ '/longvideoapi/video/updateVideo',
|
|
|
+ '/longvideoapi/video/deleteVideo',
|
|
|
+ '/longvideoapi/video/barrage/send',
|
|
|
+ '/longvideoapi/video/barrage/switch',
|
|
|
+ '/longvideoapi/video/videoActionReport',
|
|
|
+ '/longvideoapi/video/barrage/v2/list',
|
|
|
+ '/longvideoapi/video/shared/h5"',
|
|
|
+ '/longvideoapi/user/share/report',
|
|
|
+ '/longvideoapi/oss/signature',
|
|
|
+ '/longvideoapi/oss/completeUpload',
|
|
|
+ '/longvideoapi/oss/producevideo/getStsToken',
|
|
|
+ '/longvideoapi/operate/message/list',
|
|
|
+ '/longvideoapi/video/message/list',
|
|
|
+ '/longvideoapi/sys/message/list',
|
|
|
+ '/longvideoapi/user/station/message/statistics/info',
|
|
|
+ '/longvideoapi/user/station/message/statistics/read',
|
|
|
+ '/longvideoapi/user/station/message/totalCount/v2',
|
|
|
+ '/longvideoapi/user/station/message/totalRead',
|
|
|
+ '/longvideoapi/user/station/notice/list',
|
|
|
+ '/longvideoapi/user/station/message/share/list',
|
|
|
+ '/longvideoapi/user/station/message/prise/list',
|
|
|
+ '/longvideoapi/user/station/message/favorite/list',
|
|
|
+ '/longvideoapi/user/station/message/comment/list',
|
|
|
+ '/longvideoapi/user/station/message/barrage/list',
|
|
|
+ '/longvideoapi/operation/message/list',
|
|
|
+ '/longvideoapi/search/userandvideo/list',
|
|
|
+ '/longvideoapi/search/tips',
|
|
|
+ '/longvideoapi/search/user/list',
|
|
|
+ '/longvideoapi/search/video/list',
|
|
|
+ '/longvideoapi/search/hot/words',
|
|
|
+ '/longvideoapi/search/hot/videos',
|
|
|
+ '/longvideoapi/video/distribute/search/recommendVideoes/v2',
|
|
|
+ '/longvideoapi/comment/top/save',
|
|
|
+ '/longvideoapi/comment/top/page',
|
|
|
+ '/longvideoapi/comment/praise',
|
|
|
+ '/longvideoapi/comment/second/save',
|
|
|
+ '/longvideoapi/comment/second/page',
|
|
|
+ '/longvideoapi/comment/delete',
|
|
|
+ '/longvideoapi/comment/updelete',
|
|
|
+ '/longvideoapi/comment/hots',
|
|
|
+ '/longvideoapi/bank/withdraw/getBankWithdrawConfig',
|
|
|
+ '/longvideoapi/bank/withdraw/getBankWithdrawRecordList',
|
|
|
+ '/longvideoapi/bank/withdraw/wxSamllapp/requestWithdraw',
|
|
|
+ '/longvideoapi/purchase/video/list',
|
|
|
+ '/longvideoapi/profits/myself/head',
|
|
|
+ '/longvideoapi/profits/myself/list',
|
|
|
+ '/longvideoapi/profits/myself/recordList/v2',
|
|
|
+ '/longvideoapi/profits/reward/recordListAccordingToUser',
|
|
|
+ '/longvideoapi/profits/reward/recordListAccordingToVideo',
|
|
|
+ '/longvideoapi/video/reward/getVideoRewardHeadInfo',
|
|
|
+ '/longvideoapi/video/reward/getVideoRewardRecordList',
|
|
|
+ '/longvideoapi/video/reward/getVideoRewardConfig',
|
|
|
+ '/longvideoapi/video/reward/getVideoRewardConfig/v2',
|
|
|
+ '/longvideoapi/order/updateClientPayStatus',
|
|
|
+ '/longvideoapi/order/purchase',
|
|
|
+ '/longvideoapi/profits/videoPay/head',
|
|
|
+ '/longvideoapi/profits/videoPay/list',
|
|
|
+ '/longvideoapi/video/getPayedVideoPath',
|
|
|
+ '/longvideoapi/order/reward',
|
|
|
+ '/longvideoapi/video/reward/getVideoDetailRewardInfo',
|
|
|
+ '/longvideoapi/video/recommend/detailPage/list',
|
|
|
+ '/longvideoapi/video/recommend/sharePage/list',
|
|
|
+ '/longvideoapi/measure/report/view',
|
|
|
+ '/longvideoapi/video/validatePwd"',
|
|
|
+ '/longvideoapi/video/validatePwdAuth"',
|
|
|
+ '/longvideoapi/video/v2/getCutVideo',
|
|
|
+ '/longvideoapi/frontConfig/getWxFrontConfig',
|
|
|
+ '/longvideoapi/frontConfig/getVideoPlayConfig',
|
|
|
+ '/longvideoapi/frontConfig/getUserFrontConfig',
|
|
|
+ '/longvideoapi/rhythmapp/homepage/getAllVideos',
|
|
|
+ '/longvideoapi/ad/position/info'
|
|
|
]
|
|
|
|
|
|
# for i in range(len(instance_info["Instances"]["Instance"])):
|
|
@@ -178,7 +195,58 @@ if __name__ == '__main__':
|
|
|
# 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
|
|
|
# print(start_time , end_time)
|
|
|
+
|
|
|
+ HOST = 'rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com'
|
|
|
+ PORT = '3306'
|
|
|
+ DATABASE = 'devops'
|
|
|
+ USERNAME = 'devops'
|
|
|
+ PASSWORD = 'devops@123456'
|
|
|
+ conn = pymysql.connect(host=HOST, user=USERNAME, password=PASSWORD, database=DATABASE, charset="utf8")
|
|
|
+ cursor = conn.cursor()
|
|
|
+
|
|
|
appType = ['0', '4', '5', '6', '12' ,'15']
|
|
|
for index in range(len(appType)):
|
|
|
- # qps = count_qps(url, appType[index])
|
|
|
- print(appType[index])
|
|
|
+ type = appType[index]
|
|
|
+ res = count_avg_max(type)
|
|
|
+ for i in range(len(res.body)):
|
|
|
+ url = res.body[i]["requestUri"]
|
|
|
+ cnt = res.body[i]["cnt"]
|
|
|
+ max_time = res.body[i]["max_time"]
|
|
|
+ avg_time = res.body[i]["avg_time"]
|
|
|
+ sql = "UPDATE `reuqest_url_list` set `qps`=%s, `max_time`=%s, `avg_time`=%s WHERE `request_url` ='%s' and `apptype`=%s"%(cnt, max_time, avg_time, url, type)
|
|
|
+ cursor.execute(sql)
|
|
|
+ conn.commit()
|
|
|
+ for i in range(len(res.body)):
|
|
|
+ url = res.body[i]["requestUri"]
|
|
|
+ cnt = res.body[i]["cnt"]
|
|
|
+ sql = "UPDATE `reuqest_url_list` set `rt_1`=%s WHERE `request_url` ='%s' and `apptype`=%s"%(cnt, url, type)
|
|
|
+ cursor.execute(sql)
|
|
|
+ conn.commit()
|
|
|
+
|
|
|
+ res = count_rt_less_time_count(type, 200, 500)
|
|
|
+ for i in range(len(res.body)):
|
|
|
+ url = res.body[i]["requestUri"]
|
|
|
+ cnt = res.body[i]["cnt"]
|
|
|
+ sql = "UPDATE `reuqest_url_list` set `rt_2`=%s WHERE `request_url` ='%s' and `apptype`=%s" % (cnt, url, type)
|
|
|
+ cursor.execute(sql)
|
|
|
+ conn.commit()
|
|
|
+
|
|
|
+ res = count_rt_less_time_count(type, 500, 1000)
|
|
|
+ for i in range(len(res.body)):
|
|
|
+ url = res.body[i]["requestUri"]
|
|
|
+ cnt = res.body[i]["cnt"]
|
|
|
+ sql = "UPDATE `reuqest_url_list` set `rt_3`=%s WHERE `request_url` ='%s' and `apptype`=%s" % (cnt, url, type)
|
|
|
+ cursor.execute(sql)
|
|
|
+ conn.commit()
|
|
|
+
|
|
|
+ res = count_rt_less_time_count(type, 1000, 10000)
|
|
|
+ for i in range(len(res.body)):
|
|
|
+ url = res.body[i]["requestUri"]
|
|
|
+ cnt = res.body[i]["cnt"]
|
|
|
+ sql = "UPDATE `reuqest_url_list` set `rt_4`=%s WHERE `request_url` ='%s' and `apptype`=%s" % (cnt, url, type)
|
|
|
+ cursor.execute(sql)
|
|
|
+ conn.commit()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|