Skip to content

Missing diagnostics channel http.client.request.error #635

@dreamorosi

Description

@dreamorosi

Hi, I am not sure if this is the right forum to ask this question, but I since Node.js diagnostics_channel seems to fall under this working group I got here.

As of today, according to the Node.js docs there are two HTTP built-in channels for client events: http.client.request.start and http.client.response.finish.

Looking at the Node.js http module implementation, and after some tests it appears that there might be a gap in the events.

Subscribers can get notified when a request starts and when a response arrives, but there seems to not be a channel to subscribe for when the request fails (i.e. in the event of a ECONNREFUSED).

I am experimenting with tracing requests made with the http and https modules without having to patch the modules directly (which would require a loader with ESM) and without this type of channel/event if the request is going to fail any span created on http.client.request.start will remain orphaned & opened.

The fetch module has similar channels, but also has a undici:request:error channel that can be used for this.

Is the lack of this channel for the built-in HTTP events intentional? Am I misinterpreting entirely why these channels are there in the first place?

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