Hi,
We have currently an API platform based on HapiJS (v16.5.2), using good (v7.3.0) and wreck (v10.0.0).
This stack allows use a lot of logs based on good and the support of wreck events.
So the monitoring/instrumentation is ease.
With the lastest version, the wreck event are no more supported from hapi/good (hapijs/good#568).
Do you thinks it's possible to expose the wreck configuration accessible from the h2o2 package configuration ?
I'm pretty new in NodeJs, so if I miss somethings don't hesitate to fix me ๐
My workaround is to duplicate the reverse proxy mechanism in h2o2 and add the following code to activate the wreck log mechanism.
Configuration of wreck event :
const Wreck = require('wreck').defaults({ events: true });
Subscribe to wreck event (in this case, the response)
Wreck.events.on('response', handler);
Register a new event named custom
in Hapi server
Raised a custom
event server in the wreck handler
const handler = async (err, details) => {
if (err) {
throw err;
}
// Based on good source code https://github.com/hapijs/good/tree/v7.3.0
await server.events.emit('custom', new WreckResponse(err, details.req, details.res, details.start, details.uri));
};