Skip to content

fix(otlp): treat HTTP 3xx responses as export failures - #5868

Open
d4rshnn wants to merge 1 commit into
open-telemetry:mainfrom
d4rshnn:fix/otlp-http-3xx
Open

d4rshnn wants to merge 1 commit into
open-telemetry:mainfrom
d4rshnn:fix/otlp-http-3xx

Conversation

@d4rshnn

@d4rshnn d4rshnn commented Oct 31, 2026

Copy link
Copy Markdown

Assisted-by: Copilot

Description

Fixes #5865.

The OTLP HTTP exporter currently treats HTTP 3xx redirect responses as successful exports, even though redirects are disabled in the HTTP transports.

This can result in telemetry batches being silently dropped without an appropriate error being reported.

This change restricts successful HTTP responses to the 2xx status-code range. HTTP 3xx responses are now handled as non-retryable export failures, using the existing error-handling and logging behaviour.

Regression tests have been added for HTTP 302 and 308 responses across the shared HTTP client and the trace, metrics, and log exporters.

Existing retry classification and Retry-After handling remain unchanged.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • This change requires a documentation update

Checklist:

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting (targeted pytest suites and Ruff checks)
  • This requires the following PR in contrib: N/A

@d4rshnn
d4rshnn requested a review from a team as a code owner October 31, 2026 09:28
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: d4rshnn / name: Darshan Mahale (d4ed768)

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-11-02 16:42 UTC

Merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@chiragjangiir chiragjangiir left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: fix(otlp): treat HTTP 3xx responses as export failure

1. Root Cause Analysis

In the OTLP HTTP exporter, standard redirection (HTTP 3xx status codes) was not explicitly handled. Because the exporter did not follow redirects by default or handle redirection safely with POST bodies, 3xx codes could either result in silent drop or ambiguous status reporting.

2. Implementation Details

  • Explicitly checks for status codes in the 300..399 range and flags them as ExportResult.FAILURE.
  • Logs informative error message indicating that redirection is not supported for OTLP POST payloads per specification (redirects can drop request bodies in standard HTTP clients).

3. Edge Cases

  • Ensures that backoff and retry policies recognize 3xx as non-retryable without infinite loops.
  • Clean separation between transport layer errors and protocol responses.

LGTM!

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Nov 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

OTLP HTTP exporter reports a 3xx response as a successful export, so redirected batches are dropped without any log

3 participants