haskell-github-trust / ekg

Remote monitoring of running processes over HTTP
BSD 3-Clause "New" or "Revised" License
255 stars 70 forks source link

ekg doesn't complain when you don't give '+RTS -T' #4

Open thoughtpolice opened 12 years ago

thoughtpolice commented 12 years ago

If you start an application without enabling the statistics interface, the server doesn't really buy you much, nor does it inform you of the err.

It would be nice to throw up a warning, as I many times forget the -T, but unfortunately I don't know of an easy way to get at the +RTS options provided to your program. GHC apparently allows you to substitute your own main function at link-time, but I don't know if this can be done by a library. So it may require GHC hacking to provide some function in base that allows you to get at the +RTS flags.

tibbe commented 12 years ago

I think we can separate this issue into two parts:

  1. Make sure it's possible to know whether GC statistics is being collected or not.
  2. Warn the user if it's not.

If filed a bug for tracking (1): http://hackage.haskell.org/trac/ghc/ticket/5846

(2) should be simple except I don't want to e.g. print the warning to stderr, without giving the user an option to not have the message printed. Perhaps we could let the user specify this as an option when the server is started.

Note that ekg can also export lots of non-GC counters, so it's still useful even if the program isn't run with +RTS -T.

thoughtpolice commented 12 years ago

Just to keep a note of this, GHC HEAD was recently modified to fix Trac #5846 in commit ghc/packages-base@05cf0016f - there's now a function to check for GC stats, and exceptions are thrown if they're not enabled. So these warnings can happen for 7.6 users at least.

tibbe commented 12 years ago

I saw that. So my current plan (once GHC 7.6 is out) is to not include the GC stats if they aren't available (i.e. +RTS -T wasn't used) and display a warning banner in the web UI. I will also update the API docs to say that the stats might not always be there.

nh2 commented 11 years ago

If you start an application without enabling the statistics interface, the server doesn't really buy you much

It would be nice if this was mentioned somewhere on the Hackage page and in the Github Readme - I was wondering why all my graphs stay 0 until I found this issue.

tibbe commented 11 years ago

@nh2 It's documented here: http://hackage.haskell.org/package/ekg-0.3.1.3/docs/System-Remote-Monitoring.html#g:1

Perhaps the UI itself could detect the condition and show a warning.

nh2 commented 11 years ago

Ah, there is the note - all right then!