sanwa 2021-12-30 11:34:09

grafana接入sls的同比实现

(*)| select
  time,
  to_unixtime(date_parse(concat(date_format(current_timestamp, '%Y-%m-%d '),time), '%Y-%m-%d %H:%i')) as t,
  diff [1] as today,
  diff [2] as yesterday,
  diff [3] as rate
FROM  (
    select
      time,
      compare(pv, 86400) as diff
    FROM      (
        select count(1) as pv , date_format(from_unixtime(__time__), '%H:%i') as time from log group by time
      )
    group by
      time
  )
order by
  time

评论

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.123.4. UTC+08:00, 2024-04-19 18:02
浙ICP备14020137号-1 $访客地图$