hapijs / good

hapi process monitoring
Other
525 stars 161 forks source link

Support for custom events #545

Closed lostthetrail closed 7 years ago

lostthetrail commented 7 years ago

Example: I have an http client that emits events much like wreck, but includes a bunch of additional features.

Is there a way to support custom events, much like wreck is currently supported, in the library?

arb commented 7 years ago

Not at this time. There IS a way you could hack it but it's not documented and would require you doing some things you "aren't supposed to do".

lostthetrail commented 7 years ago

That sounds like it may be a better option than clone and own of Good... Your thoughts?

arb commented 7 years ago

It's unlikely that we'll add support for custom things outside the hapi ecosystem. If you're http client has a handle to a hapi server object, you could just send logs though that, then it would get picked up by good.

The magic that lets wreck logging work is https://github.com/hapijs/good/blob/master/lib/monitor.js#L141-L144. I guess if we really really wanted to add outside things, we would do it similar to that but again, I don't know if there's much value in that change. If we supported outside things, they would all have to agree to the same interface to work with good and I really doubt we'll be able to make that happen. Like your http how were you planning sending out logging information?

lostthetrail commented 7 years ago

The plan was to have the http client emit events on a symbol. The events were to contain timing information for both aggregated metrics and specific logging for debugging.

For example: using that timing information to know you have a DNS problem, but also to correlate a single users bad experience with a slow response in creating a socket.

I could just log it out directly or attach the timings to the response object.

lostthetrail commented 7 years ago

For now, I have just been using request.log to get the support I wanted.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.