阿里云sls日志服务如何查某个具体字段的平均数

1: 需求:

  查询线上某个接口(如:list_new)的成功率和时延

查接口时延的写法在网上找了一堆,都是语法错误,最后在阿里云官方api找到了正确的

2:贴一下阿里云官方文档:

聚合函数的语法及示例_日志服务-阿里云帮助中心

3:成功率:

3.1:在ngix_ssl查询200的所有接口数

* and request_uri: "/camera/worthcloud/v3/cam/list_new"  and status:200

3.2: 再查询失败的接口数:

* and request_uri: "/camera/worthcloud/v3/cam/list_new"  and status>200

3.3:每页是20条数据;所以可以计算下:

总条数:2101811×20+116×20

成功的条数:2101811×20

成功率:成功条数/总条数%=99.994481%

4:时延:

时延字段:upstream_response_time

查询upstream_response_time字段的平均数:

| SELECT avg(upstream_response_time) AS upstream_response_time

查询list_new 接口成功的时延迟:

* and request_uri: "/camera/worthcloud/v3/cam/list_new" and status:200 | SELECT avg(upstream_response_time) AS upstream_response_time

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2023-12-12 07:42:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-12 07:42:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-12 07:42:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-12 07:42:01       20 阅读

热门阅读

  1. uniapp flex:1不生效

    2023-12-12 07:42:01       35 阅读
  2. 什么是rocketmq❓

    2023-12-12 07:42:01       34 阅读
  3. Python从门到精通(九):numpy科学计算库

    2023-12-12 07:42:01       42 阅读
  4. Python中求取数字位数的方法

    2023-12-12 07:42:01       33 阅读
  5. 线上问题得解决

    2023-12-12 07:42:01       39 阅读
  6. Spring-xml版本

    2023-12-12 07:42:01       44 阅读
  7. Mysql mybatis 语法示例

    2023-12-12 07:42:01       41 阅读
  8. Docker与K8s的区别

    2023-12-12 07:42:01       38 阅读