网络监控组件所采集的信息都上报到了 support-logs 这个 project 的 yyzc-logs(正式)、yyzc-logs-test(测试)logstore,登陆阿里云日志服务到对应的 logstore,查询关注的信息。
以下提供部分查询 SQL ,仅供参考:
1.查询接口总体请求成功率
* and appVer>="4.9.0" | select date_format(date_trunc('day', __time__), '%m-%d') as time, round(try_cast(count_if(responseCode = 200 or responseCode = 304 or responseCode = 206) as double)/count(1), 4) as success_rate from log where (appName = 'com.test.demo' or appName = 'com.test1.demo') group by time order by time limit 1000

2.总体请求成功率细分
* and appVer>="4.9.0" | select date_format(date_trunc('day', __time__), '%m-%d') as time, round(try_cast(count_if((responseCode = 200 or responseCode = 304 and responseCode = 206) and platform = 'iOS') as double)/count_if(platform = 'iOS'), 4) as iOS_Success_Rate, round(try_cast(count_if((responseCode = 200 or responseCode = 304 or responseCode = 206) and platform = 'Android') as double)/count_if(platform = 'Android'), 4) as Android_Success_Rate from log where appName = 'com.test.demo' or appName = 'com.test1.demo' group by time order by time limit 1000

3.接口平均耗时
- 接口平均耗时(总体)
* and appVer>="4.9.0" |
select platform,round(sum(endTime-beginTime)*1.0/count(*),2) as avgHandleTime
where appName = 'com.test.demo' or appName = 'com.test1.demo'
group by platform
order by avgHandleTime desc
- 接口平均耗时(iOS)
* and appVer>="4.9.0" and platform: "iOS" and appName:"com.test.demo" |
select url,round(sum(endTime-beginTime)*1.0/count(*),2) as avgHandleTime,count(*) as count
group by url
order by avgHandleTime desc
网友评论