Skip to content

Enhance spans by adding Undici events as event spans #2539

Open
@giliomix

Description

@giliomix

I’d like to request an enhancement to the instrumentation-undici package.

Is your feature request related to a problem? Please describe

Currently, we lack visibility into the HTTP request lifecycle within spans when using the instrumentation-undici package. This limits our ability to observe and trace stages of HTTP requests using undici.

Describe the solution you'd like to see

  • Add undici:request:headers and undici:client:sendHeaders events on the relevant span.
  • Subscribe to the undici:request:bodySent event and also add it as event to the span.

Currently, the instrumentation-undici package subscribes to the undici:request:headers and undici:client:sendHeaders events via diagnostics_channel. However, these events are not being added as event spans to the corresponding spans.
Additionally, the undici:request:bodySent event is not yet subscribed to, but we can subscribe it and add it as an event span as well.
Without these events, the span lacks a detailed breakdown of the HTTP request lifecycle stages.

Additional context

Including these events as events in spans will enhance the observability of HTTP requests made with Undici and align with the best practices of providing detailed and actionable telemetry data.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions