'FnordMetric Toplist Gauges Disappear

What I'm trying to do

I'm using FnordMetric Classic through the fnordmetric ruby on rails gem, as shown in Railscasts #378.

I would like to have a list of my "popular pages", where a page is a type of content of my web app.

Problem

Regardless of the used version, in production as well as in development, the contents of my so called toplist gauges keep disappearing.

This can be seen in the following screenshot, where the list "Top Keys" of the "Popular Pages Toplist Gauge" is empty, where it should be filled with the most visited pages.

Screenshot -- the toplist gauge is empty, but it should not

A few observations

  • When I trigger an event, for example, visit a page on the monitored app, the visited page appears in the fnordmetric toplist gauge. But after a couple of minutes, it disappears.
  • I've tried to increase the storage duration setting, without effect.
  • As can be seen in the screenshot, the number of samples is not zero (it is 2.00). Therefore, the data has to be in the database, but it is not displayed.

Source code

This is the relevant part of the source code to create this gauge:

 # script/fnordmetric_app.rb
 require 'fnordmetric'
 
 FnordMetric.namespace :my_web_app do
   toplist_gauge :popular_pages, title: "Popular Pages"
   event :show_page do
     observe :popular_pages, data[:title]
   end
   # ...
 end
 
 FnordMetric::Web.new(port: 4242, use: middleware)
 FnordMetric::Worker.new
 FnordMetric.run

Does anyone have a clue what I'm doing wrong?



Solution 1:[1]

Maybe the title attribute on the data you send is blank?

You could also check the data is redis with redis-cli (I would use the MONITOR command).

Also FordMetrics is now discontinued and is now a charting library called clip:

What happened to the project name?

The project was started in 2011 and was initially called "FnordMetric". The first version from 8 years ago also included facilities for storing and transforming data in addition to the charting code. Over time, the data processing parts were removed, leaving only the plotting code. However, as a consequence, most of the search queries for the project name would return outdated information, resulting in a generally confusing and stale-feeling situation. The best solution seemed to be to rename the project and so it was renamed to "clip".

Nowadays I would write it manually in the database instead of redis:

  • have an events table with kind (string) and data (jsonb)
  • on a products#show, create an event with kind: product_show and data product.attributes like Ryan Bates did in the railscast
  • In your admin interface do a query like:
Event
  .where(kind: "product_show")
  .group("data->>'id'")
  .select("count(*) as count, array_agg(data->>'title')[1] as title)
  • render those products

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dorian