Skip to content

fix(observability): read exporter headers from where OTel 1.45 keeps them - #81

Merged
harshuljain13 merged 1 commit into
mainfrom
fix/otel-exporter-headers
Oct 15, 2026
Merged

harshuljain13 merged 1 commit into
mainfrom
fix/otel-exporter-headers

Conversation

@harshuljain13

Copy link
Copy Markdown
Collaborator

What changed, and why

CI went red on main without anyone changing it. Four tests in test_exporters.py began failing with:

AttributeError: 'OTLPSpanExporter' object has no attribute '_headers'

Nothing in the tree moved. opentelemetry-exporter-otlp-proto-http is constrained >=1.27 with no upper bound, so CI resolves whatever is newest — it installed 1.45.1 — and 1.45 restructured the exporter. It grew an inner _client that owns the transport, and the headers went with it:

# 1.44                          # 1.45
exporter._headers               exporter._client._headers

_endpoint stayed on the exporter, which is why only the header assertions broke and the endpoint ones passed.

These tests reach into that private attribute deliberately — it is how they prove a builder's environment config maps to the right wire target without opening a socket — so the fix keeps doing that and absorbs the move. A _headers helper now accepts either layout, exactly as the _exporter helper directly above it already absorbs a processor attribute rename.

The helper also lower-cases the names. 1.45 normalises them, and HTTP header names are case-insensitive (RFC 9110 §5.1), so the casing a builder happens to pass was never the property worth asserting on.

Test-only. No shipped code changed.

How it was verified

The failure is version-dependent, so testing it on one version proves nothing. I ran the suite against both:

opentelemetry-exporter-otlp-proto-http Before After
1.44.0 — what a current environment resolves 7 passed 7 passed
1.45.1 — what CI installed when it failed 4 failed, 3 passed 7 passed

Full suite under 1.45.1: 950 passed, 26 skipped, 3 xfailed, exit 0.

I also confirmed the mechanism rather than inferring it, by constructing an exporter under 1.45.1 and inspecting it:

instance attrs: _endpoint, _compression, _max_request_size, _client, _shutdown, _metrics
                                                            ^^^^^^^  no _headers
_client._headers: {'content-type': ..., 'authorization': 'k', 'x-thing': 'v'}
                                         ^^^^^^^^^^^^^ lower-cased

Gate on this branch, checked on exit code: ruff check . 0, ruff format --check . 0, mkdocs build --strict 0, agentship verify --agents-dir examples 0 (grid 11/11, 0 over-claims).

Checklist

  • make test passes locally.
  • ruff check and ruff format --check are clean.
  • agentship verify still exits 0, with no new over-claims.
  • If an engine capability was declared or changed, its conformance cell proves it. — none changed.
  • Public surface changes are reflected in docs/capabilities/. — no public surface change.
  • docs/CHANGELOG.md has an entry under ## [Unreleased]. — this PR creates the section, since 0.0.4 was just cut.
  • A non-obvious design decision has an ADR in docs/decisions/. — none; the reasoning is in the helper's docstring.
  • Version numbers untouched.

Anything deliberately left undone

  • The underlying exposure is unchanged. An unpinned upper bound means the next OTel release can break the build again with no commit of ours. Capping it is a real option, but doing that on a red build would mask this rather than fix it, and a cap has its own cost — it pins the whole transitive OTel set and would conflict with livekit-agents, which already carries its own opentelemetry-api<1.45 bound. Worth deciding separately; I did not want to make that call inside a CI-unblocking PR.
  • The tests still read private attributes. That is the existing design and I kept it: the alternative is a real collector or a mocked transport, which buys little for a config-mapping assertion and costs a network or a fake. The helper now makes the version-fragility explicit and documented in one place instead of spread across four assertions.
  • This blocks chore(branding): apply the brand kit to the repo, docs site and Studio #80. That PR is red for this reason alone — it is a branding change and touches no observability code. Merging this first and updating chore(branding): apply the brand kit to the repo, docs site and Studio #80 should take it green.

…them

CI went red on `main` without anyone changing it. Four exporter tests began
failing with:

    AttributeError: 'OTLPSpanExporter' object has no attribute '_headers'

Nothing in the tree moved. `opentelemetry-exporter-otlp-proto-http` is
constrained `>=1.27` with no upper bound, so CI resolves whatever is newest, and
1.45 restructured the exporter: it grew an inner `_client` that owns the
transport, and the headers went with it. `_endpoint` stayed where it was, which
is why only the header assertions broke.

These tests reach into that private attribute on purpose — it is how they prove
a builder's environment config maps to the right wire target without opening a
socket — so the fix is to keep doing that and absorb the move. A `_headers`
helper now accepts either layout, exactly as the `_exporter` helper beside it
already absorbs a processor attribute rename.

The helper also lower-cases the names. 1.45 normalises them, and HTTP header
names are case-insensitive (RFC 9110 §5.1), so the casing a builder happens to
pass was never the property worth asserting on.

No shipped code changed; this is test-only. Verified by running the suite
against both versions: 1.44.0, which is what a current lockfile resolves, and
1.45.1, which is what CI installed when it failed. Green on both.

The underlying exposure is unchanged — an unpinned upper bound means a future
OTel release can break the build again with no commit of ours. Worth a decision
on whether to cap it, but capping on a red build would mask this rather than
fix it.
@harshuljain13 harshuljain13 added the bug Something isn't working label Oct 14, 2026
@harshuljain13 harshuljain13 self-assigned this Oct 14, 2026
@harshuljain13
harshuljain13 requested a review from Parv17k October 14, 2026 11:29
@harshuljain13 harshuljain13 added this to the 0.1.0 milestone Oct 14, 2026
@harshuljain13
harshuljain13 merged commit 671ffcd into main Oct 15, 2026
4 checks passed
@harshuljain13
harshuljain13 deleted the fix/otel-exporter-headers branch October 15, 2026 08:57
@harshuljain13 harshuljain13 added type:bug Behaves differently from what it says it does area:observability Tracing pipeline and exporters and removed bug Something isn't working labels Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:observability Tracing pipeline and exporters type:bug Behaves differently from what it says it does

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant