News for hackers. Stuff that matters.
Re:Grafana 7.0 by svenklemm on Monday May 18, 2020 @08:43PM (#23230100)
To get graphs for this week and the last 3 weeks in the same panel you could use something like this:

  SELECT i::text as metric, l1.*
    FROM 
    (SELECT
    g1 AS i,
    g1 * '1week'::interval AS interval,
   '1 week'::interval AS span,
    now() AS start
  FROM generate_series(0,3) g1) g1
  JOIN LATERAL (
    SELECT
   time + interval AS time,
   value
  FROM metrics
  WHERE time > start - (span+interval) AND time < start - 
  interval
  ) l1 ON TRUE
  ORDER BY time;

There are no comments on this comment yet.