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-2023 iteam. Current version is 2.107.0. UTC+08:00, 2023-02-08 05:39
浙ICP备14020137号-1 $访客地图$