44

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?

Diggy.
  • 6,744
  • 3
  • 19
  • 38
fiedl
  • 5,667
  • 4
  • 44
  • 57
  • 1
    My suggestion is to use https://github.com/ankane/blazer which is a simple rails application that stores sql queries and lets you build graphical dashboards with your queries. – Blair Anderson Jan 04 '17 at 19:05
  • 1
    Are you hitting a cache limit, which is pushing your results out faster than expected? Also, which server are you running in dev and production? – Phil Dec 06 '17 at 11:51
  • 2
    I’m voting to close this question because it has no answer, it is 3 years old and the person who ased the question is clearly no longer interested in an answer. There is nothing here that would benefit anyone if it were to be answered – jamesc Jun 29 '20 at 08:21
  • 1
    I‘ve stopped using fnordmetric due to this issue. If a solution would be helpful to others, I‘d certainly willing to help to tackle this down. However, it looks like fnordmetric has moved on. Also, the corresponding issue has been closed without resolution. https://github.com/asmuth/clip/issues/171. Feel free to close this one. – fiedl Jun 30 '20 at 10:43

1 Answers1

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
Dorian
  • 7,749
  • 4
  • 38
  • 57