更新时间:2024-10-15 GMT+08:00
分享

METRIC仪表盘模板

用户在LTS页面只需按照业务需要创建指标规则即可生成自己的统计报表,设置单个日志过滤条件或通过添加关联关系和添加组设置多个日志过滤条件,保留符合条件的日志,对用户特定时间范围内已结构化的日志进行动态统计,并将统计结果动态呈现到aom的Prometheus实例,操作简单且功能强大。

前提条件

日志生成指标任务监控中心

  1. 登录云日志服务控制台,在左侧导航栏中选择“仪表盘 ”。
  2. 在仪表盘模板下方,选择“METRIC仪表盘模板 > 日志生成指标任务监控中心”,查看图表详情。

    • 过滤规则ID,所关联的查询分析语句如下所示:
      select distinct(task_set)
    • 输入行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "input" < 1000 THEN concat( cast( "input" AS VARCHAR ), '行' )  WHEN "input" < 1000 * 1000 THEN concat( cast( round( "input"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "input" < 1000000000 THEN concat( cast( round( "input"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "input"/ 1000.0 < 1000000000 THEN concat( cast( round( "input"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "input"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("input") as "input")
    • 输出行数图表所关联的查询分析语句如下所示
      SELECT CASE   WHEN  "output" < 1000 THEN concat( cast( "output" AS VARCHAR ), '行' )  WHEN "output" < 1000 * 1000 THEN concat( cast( round( "output"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "output" < 1000000000 THEN concat( cast( round( "output"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "output"/ 1000.0 < 1000000000 THEN concat( cast( round( "output"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "output"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("output") as "output")
    • 满足过滤条件行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "filters" < 1000 THEN concat( cast( "filters" AS VARCHAR ), '行' )  WHEN "filters" < 1000 * 1000 THEN concat( cast( round( "filters"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "filters" < 1000000000 THEN concat( cast( round( "filters"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "filters"/ 1000.0 < 1000000000 THEN concat( cast( round( "filters"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "filters"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("filters") as "filters")
    • 不满足过滤条件行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "filter_drops" < 1000 THEN concat( cast( "filter_drops" AS VARCHAR ), '行' )  WHEN "filter_drops" < 1000 * 1000 THEN concat( cast( round( "filter_drops"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "filter_drops" < 1000000000 THEN concat( cast( round( "filter_drops"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "filter_drops"/ 1000.0 < 1000000000 THEN concat( cast( round( "filter_drops"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "filter_drops"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("filter_drops") as "filter_drops")
    • 采样行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "samples" < 1000 THEN concat( cast( "samples" AS VARCHAR ), '行' )  WHEN "samples" < 1000 * 1000 THEN concat( cast( round( "samples"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "samples" < 1000000000 THEN concat( cast( round( "samples"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "samples"/ 1000.0 < 1000000000 THEN concat( cast( round( "samples"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "samples"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("samples") as "samples")
    • 采样丢弃行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "sample_drops" < 1000 THEN concat( cast( "sample_drops" AS VARCHAR ), '行' )  WHEN "sample_drops" < 1000 * 1000 THEN concat( cast( round( "sample_drops"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "sample_drops" < 1000000000 THEN concat( cast( round( "sample_drops"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "sample_drops"/ 1000.0 < 1000000000 THEN concat( cast( round( "sample_drops"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "sample_drops"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum( "sample_drops" ) as "sample_drops")
    • 超过日志时间范围行数图表所关联的查询分析语句如下所示:
      SELECT CASE   WHEN  "out_of_bounds" < 1000 THEN concat( cast( "out_of_bounds" AS VARCHAR ), '行' )  WHEN "out_of_bounds" < 1000 * 1000 THEN concat( cast( round( "out_of_bounds"/ 1000, 1 ) AS VARCHAR ), '千行' ) WHEN "out_of_bounds" < 1000000000 THEN concat( cast( round( "out_of_bounds"/ 1000000.0, 1 ) AS VARCHAR ), '百万行' )  WHEN "out_of_bounds"/ 1000.0 < 1000000000 THEN concat( cast( round( "out_of_bounds"/ 1000 / 1000000.0, 1 ) AS VARCHAR ), '十亿行' ) ELSE concat( cast( round( "out_of_bounds"/ 1000.0 / 1000 / 1000 / 1000, 1 ) AS VARCHAR ), '万亿行' )  END AS  "total"  from (select sum("out_of_bounds") as "out_of_bounds")
    • 执行记录图表所关联的查询分析语句如下所示:
      select TIME_FORMAT( "__time", 'yyyy-MM-dd HH:mm:ss:SSS', '+08:00') as "统计时间", sum("input") as "输入行数",sum("output") as "输出行数",sum("filters") as "满足过滤条件行数",sum("filter_drops") as "不满足过滤条件行数",sum("samples") as "采样行数",sum("sample_drops") as "采样丢弃行数",sum("out_of_bounds") as "超过日志时间范围行数" group by __time order by __time desc limit 1000

相关文档