Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wreck instrumentation #81

Closed
guenogu opened this issue Aug 6, 2018 · 4 comments
Closed

Wreck instrumentation #81

guenogu opened this issue Aug 6, 2018 · 4 comments
Labels
feature New functionality or improvement

Comments

@guenogu
Copy link

guenogu commented Aug 6, 2018

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

server.event('custom');

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));
};
@spanditcaa
Copy link
Contributor

Sure - can you prepare a pull request ?

@spanditcaa spanditcaa added the feature New functionality or improvement label Aug 6, 2018
@hueniverse
Copy link
Contributor

@guenogu planning on submitting a PR?

@spanditcaa
Copy link
Contributor

This would be supported by #92 -closing as superceded @guenogu

@lock
Copy link

lock bot commented Jan 9, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants