nebraska icon indicating copy to clipboard operation
nebraska copied to clipboard

Investigate whether to show active instances instead of total instances in timeline charts

Open joaquimrocha opened this issue 4 years ago • 1 comments

We are showing the total number of instances per period in our timeline, i.e. if a test instance registered once 29 days ago, it gets included in the rest of the chart. An alternative is to only check which instances registered in the last period P for each timeline point, e.g. if we consider active instances to be the ones who connected in less than 24h ago, then that instance of 29 days in the previous example would only be counted in the 24h period after it registered.

This arguably gives a more useful idea of the cluster load during the chosen period. On the other hand, we cannot use the same criteria for the update status (round charts), as those are instended to be used as statistics for the whole period. This means that implementing an "active instances" timeline needs to be better clarified in the UI. A possible solutions is to add a ? icon that shows a tooltip explaning the criteria in each chart.

And we could also add more options to make it useful for different use-cases:

  • Add a toggle of "Total | Active" to show the current timeline or the active instances, respectively.
  • Add a way to choose what "active" means. Maybe a new field in each group, defaulting to 24h, so users who have instances pinging every week could change it and have the timelines being created for that specific configuration.

joaquimrocha avatar May 12 '20 12:05 joaquimrocha

I poked around in the postgres back-end and came up with the following SQL to get this data, maybe it's useful to you:

Inputs:

  • group name (e.g. "Stable (AMD64)")
  • end timestamp (e.g. now)
  • start timestamp (e.g. "2020-01-01 12:30:00")
  • "active" interval (e.g. "1 day")
SELECT ts, COUNT(ia.*)
   FROM
      generate_series(timestamp 'START_TIMESTAMP',
                      timestamp 'END_TIMESTAMP',
                     '1 day') as ts,
      instance_application as ia,
      instance as i,
      groups as g
    WHERE i.id = ia.instance_id
        AND ia.group_id = g.id
        AND i.created_ts < ts
        AND g.name = 'GROUP_NAME'
        AND ia.last_check_for_updates > ts - interval 'ACTIVE_INTERVAL'
  group by ts
  order by ts;

t-lo avatar May 12 '20 15:05 t-lo