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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to diagnostics_channel to core #2697

Closed
RafaelGSS opened this issue Nov 19, 2020 · 12 comments
Closed

Add support to diagnostics_channel to core #2697

RafaelGSS opened this issue Nov 19, 2020 · 12 comments
Labels
feature request New feature to be added

Comments

@RafaelGSS
Copy link
Member

馃殌 Feature Proposal

Hey folks!

The diagnostics_channel was landed on v15 and seems fair to think about to include it on fastify core, since that it will help the APM vendors and self-analysis.

@Qard made nice work there and I mentioned here to help us if needed.

For further information, check the PR here and the changelog here.

The stability on the core is still experimental but seems fair to talk about now.

@RafaelGSS RafaelGSS added the feature request New feature to be added label Nov 19, 2020
@mcollina
Copy link
Member

It'd be good to have an official plugin for it. All the critical information should be available for plugins to consume anyway.

@AyoubElk
Copy link
Member

It'd be good to have an official plugin for it. All the critical information should be available for plugins to consume anyway.

I'd be interested in working on this plugin. What kind of information do you think would be nice to have published?

@mcollina
Copy link
Member

Not entirely sure :). Maybe @Qard can help!

@Qard
Copy link

Qard commented Nov 19, 2020

The main thing I'd see APMs wanting to know from fastify is middleware and routing transitions. Having a name for the middleware and method + routing pattern for the routes would be perfect. I'd need to take a closer look to see if there's anything else interesting in there, but that's a good place to start.

@mcollina
Copy link
Member

Out that could be implemented is by adding a hook in onRoute. That will have all the lifecycle hooks registered for a given route, so you can essentially wrap all of them.

@Qard
Copy link

Qard commented Nov 19, 2020

It'd also help to know when a response is sent. Basically, an APM will want to produce a "span" around each middleware or route, so the transitions can be the start of a new span and then the end is either when another transition happens or a response is started.

@RafaelGSS
Copy link
Member Author

A plugin seems a better choice since the information needed is available through hooks. In case of the response sent, we have the onSend hook available.

My worry is because the hooks need to be called immediately after the event, to get the elapsed time and metrics around it. At this time, I believe that a plugin is enough.

@RafaelGSS
Copy link
Member Author

Base repo created. Tonight, I'll adjust the foundation to create the plugin https://github.com/fastify/fastify-diagnostics-channel.

@RafaelGSS
Copy link
Member Author

@Qard Span API block this PR? Otherwise, how do you think that is better to provide the information? I mean, some basic rules as:

  • For every route registered send a message through a channel.
  • For every request send these X info

Therefore, we have some best pratices to create a channel name or something like that?

@Qard
Copy link

Qard commented Nov 26, 2020

For now, I would just add transition events and not worry about spans. Spans can be added later, if we eventually decide on an API for that.

For comparison, here's the changes I did for express: pillarjs/router#96. It doesn't have spans, just a single event when the transition happens with (hopefully) sufficient metadata to identify the full routing path. (The routing path thing is complicated in express, which is why that hasn't landed yet...I'll get back to it at some point soon, hopefully...)

@RafaelGSS
Copy link
Member Author

PR created: fastify/fastify-diagnostics-channel#3

@mcollina
Copy link
Member

I think this could be closed for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature to be added
Projects
None yet
Development

No branches or pull requests

4 participants