Skip to content

httpx: OpenTelemetry spans never end for RedirectHandler_send and retry_cae_response_if_required #508

@jackmpcollins

Description

@jackmpcollins

The OpenTelemetry spans created in RedirectHandler.send ("RedirectHandler_send - redirect N") and HttpxRequestAdapter.retry_cae_response_if_required are not ended on the normal (non-error) code paths. In trace viewers, these spans appear to run indefinitely, making requests look “hung” even when the underlying HTTP call completes.

To Reproduce: make any request using a kiota-generate client ?

Expected behavior: Spans for redirect attempts and CAE retry decision should end when the operation finishes, so durations reflect real time spent.

Suggested fix

  • Ensure _redirect_span.end() is called for each redirect attempt, e.g. in a finally: around the loop body.
  • Ensure the span started in retry_cae_response_if_required is ended on all return paths (including when it triggers a retry).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions