Repository navigation
Conversation
OpenTelemetry 1.45 removed OTLPSpanExporter._headers and ._session, so AuthenticatedOTLPExporter._prepare_headers raised AttributeError and every span export returned FAILURE. Create the session in the exporter and pass it to the parent via the public session argument instead.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
📘 Description
With
opentelemetry-exporter-otlp-proto-http1.45.0 (released 2026-09-25) installed,agentops.init()no longer delivers any spans.AuthenticatedOTLPExporter._prepare_headersreadsself._headersandexportswapsself._session.headers. 1.45.0 removed both attributes fromOTLPSpanExporterwhen it moved to the sharedopentelemetry-exporter-otlp-common/opentelemetry-exporter-http-transportpackages (open-telemetry/opentelemetry-python#5389). Every export raisesAttributeError, and the catch-all at the end ofexportlogs it and returnsSpanExportResult.FAILURE:pyproject.toml(andagentops0.4.21 on PyPI) allowsopentelemetry-exporter-otlp-proto-http>1.29.0on Python >=3.10 with no upper bound, so a fresh install resolves 1.45.1.uv.lockpins 1.31.1 for Python >=3.10, so an environment built from the lockfile does not hit it.The change creates the
requests.SessioninAuthenticatedOTLPExporter.__init__, passes it to the parent through the publicsession=argument, and does the existing JWT header swap on that session._prepare_headersandexportno longer touch_headersor_session.pyproject.tomlis untouched; #1458 edits the same OpenTelemetry pins.🧪 Testing
Base:
mainat f8e907b. Clean venvs, Python 3.12, one with OTel 1.45.1 (whatpip installresolves today), one with theuv.lockpins (sdk/api/exporter 1.31.1, instrumentation/semconv 0.52b1).Attribute check:
hasattr(OTLPSpanExporter(endpoint=..., headers=...), "_headers")and"_session"on 13 releases between 1.31.1 and 1.45.1 (1.31.1, 1.34.1, 1.36.0, 1.37.0, 1.38.0, 1.39.1, 1.40.0, 1.41.1, 1.42.0, 1.43.0, 1.44.0, 1.45.0, 1.45.1). True through 1.44.0, False for 1.45.0 and 1.45.1.End to end through
agentops.init()against a local fake backend (script below; DNS for any non-loopback host is blocked, so nothing leaves the machine):Bearer jwt-abcBearer jwt-abcBearer jwt-abcUnit tests,
python -m pytest tests/unit/sdk/test_exporters.py -q -p no:cacheprovider -p no:depends -o log_cli=false:test_export_empty_spans_list,test_export_jwt_expired_exception,test_export_success,test_headers_protected_from_override,test_full_export_cycle), 11 passedThe added
test_export_sends_jwt_and_custom_headersruns the real parentexport()withrequests.Session.sendpatched, and asserts the request carriesAuthorization: Bearer <jwt>(a user-suppliedAuthorizationis ignored) andX-Custom-Header. With the baseexporters.pyrestored viagit checkout f8e907b -- agentops/sdk/exporters.py, it fails on 1.45.1 (6 failed in total) and passes on 1.31.1.Full
tests/uniton this branch withopenai-agentsinstalled: 489 passed, 1 skipped on both OTel 1.45.1 and 1.31.1.ruff@0.12.9 checkandruff format --checkon both changed files: clean.Not run: Python 3.9 with OTel 1.29.0 (the pinned version there).
pyproject.tomlrequires >1.29.0 on Python >=3.10 and I ran 3.12. I read the 1.29.0 source instead:OTLPSpanExporter.__init__acceptssessionand doesself._session = session or requests.Session().End-to-end repro script (
fakesrv.py+repro.py)fakesrv.py:repro.py(run aspython -I repro.pyfrom an empty directory, withfakesrv.pyin/tmp/probe):