hapijs / good

hapi process monitoring
Other
525 stars 160 forks source link

Add extension function for request includes #566

Closed sfhardman closed 6 years ago

sfhardman commented 6 years ago

The change is to allow users to extract extra data out of the Hapi request object and populate it into an 'extensionData' field on the event passed to reporters. My use case is for passing authentication information from request.auth (as per the example added to API.md), but it could be used for other edge cases people may have that are not worth specifically implementing in the core library.

arb commented 6 years ago

What specific problem is this trying to solve? What do you want out of request objects that you are missing?

In general, I've avoided exposing functions as arguments because you can't express that as JSON and a lot of people configure their hapi servers with JSON.

sfhardman commented 6 years ago

This was to allow the username to be in the logs - for me this is coming from request.auth.credentials.username

The previous issue (https://github.com/hapijs/good/pull/558) around getting authentication info into the event payloads was closed because the form of request.auth is not standardised.

frankthelen commented 6 years ago

👍 I also need a way to log request.auth.credentials.username into the request logs. If possible, even more from request.auth.credentials.

hueniverse commented 6 years ago

Is this being merged or closed?

sfhardman commented 6 years ago

My impression is it isn't going to be accepted, so I have switched to monkeypatching good/lib/utils instead

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.