Skip to content

Add support to diagnostics_channel to core聽#2697

Closed

Description

@RafaelGSS

馃殌 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.

Activity

  1. mcollina commented on Nov 19, 2020

    @mcollina
    Member

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

  2. AyoubElk commented on Nov 19, 2020

    @AyoubElk
    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?

  3. mcollina commented on Nov 19, 2020

    @mcollina
    Member

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

  4. Qard commented on Nov 19, 2020

    @Qard

    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.

  5. mcollina commented on Nov 19, 2020

    @mcollina
    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.

  6. Qard commented on Nov 19, 2020

    @Qard

    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.

  7. RafaelGSS commented on Nov 19, 2020

    @RafaelGSS
    MemberAuthor

    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.

  8. RafaelGSS commented on Nov 23, 2020

    @RafaelGSS
    MemberAuthor

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

  9. RafaelGSS commented on Nov 25, 2020

    @RafaelGSS
    MemberAuthor

    @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?

  10. Qard commented on Nov 26, 2020

    @Qard

    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...)

  11. RafaelGSS commented on Dec 16, 2020

    @RafaelGSS
    MemberAuthor
  12. mcollina commented on Dec 16, 2020

    @mcollina
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions