Incrementally consuming the eventlog
Don Stewart
dons00 at gmail.com
Sun May 1 19:22:29 CEST 2011
I've put a library for incremental parsing of the event log here:
http://code.haskell.org/~dons/code/ghc-events-stream/
The goal is to implement something like:
http://www.erlang.org/doc/man/heart.html
On Sun, May 1, 2011 at 1:44 AM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Fri, Apr 29, 2011 at 12:00 AM, Don Stewart <dons00 at gmail.com> wrote:
>> I'm very interested in what the best way to get incremental event data
>> from a running GHC process would be.
>>
>> Looking at the code, we flush the event buffer fairly regularly, but
>> the event parser is currently strict.
>>
>> So we'd need a lazy (or incremental) parser, that'll return a list of
>> successful event parses, then block. I suspect this mode would be
>> supported.
>>
>> *My evil plan is to write a little monitoring web app that just
>> attaches to the event stream and renders it in a useful "heartbeat"
>> format* , but I need incremental parsing.
>
> A less general solution might be to have the program itself start a
> little web server on some port and use the API I proposed to serve
> JSON data with the aggregate statistics you care about. Example:
>
> main = do
> eventData <- newIORef
> server <- serveOn 8080 $ \ _req -> readIORef eventData >>=
> sendResponse eventData
> registerEventListener $ \ ev -> updateEventData eventData ev
> runNormalProgram
>
> You can wrap the creation of the webserver in a little helper function
> an make any program "monitorable" simply by doing
>
> main = withMonitoring runApp
>
> withMonitoring would take care of starting/stopping the webserver and
> processing events.
>
> Just a thought.
>
> Johan
>
More information about the Glasgow-haskell-users
mailing list