Skip to content

Push rvzxmmpxzpsu - #3

Draft
aabmass wants to merge 50 commits into
push-vyqnmrotnzklfrom
push-rvzxmmpxzpsu
Draft

aabmass wants to merge 50 commits into
push-vyqnmrotnzklfrom
push-rvzxmmpxzpsu

Conversation

@aabmass

@aabmass aabmass commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • 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 to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

otelbot Bot and others added 30 commits October 6, 2026 17:59
* Backport 1.45.1/0.66b1 changelog

* Apply suggestion from @emdneto

---------

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…en-telemetry#5145)

Spotted this during last release. The `.dev`doesn't get removed by scripts. Although there's no issue during installation
…active_requests` (open-telemetry#5125)

* fix(falcon): use the semconv unit for http.server.active_requests

The semantic conventions define http.server.active_requests with the
UCUM annotation unit {request}, and every other HTTP server
instrumentation emits it that way.

falcon declared the unit as "requests", including the path that reuses
opentelemetry-instrumentation-wsgi helpers, so the same metric was
exported with two different units depending on the instrumentation.

Assisted-by: Claude

* fix(tornado): use the semconv unit for http.server.active_requests

The semantic conventions define http.server.active_requests with the
UCUM annotation unit {request}. tornado declared the unit as
"requests" for both the old and the new semantic convention modes,
so the metric disagreed with the rest of the HTTP server
instrumentations.

Assisted-by: Claude

* fix(tornado): use the semconv unit for http.server.active_requests

The semantic conventions define http.server.active_requests with the
UCUM annotation unit {request}. tornado declared the unit as
"requests" for both the old and the new semantic convention modes,
so the metric disagreed with the rest of the HTTP server
instrumentations.

Assisted-by: Claude

* test(falcon): assert the semconv unit of http.server.active_requests

Assisted-by: Claude

* test(tornado): assert the semconv unit of http.server.active_requests

Assisted-by: Claude

* chore: add changelog fragment for open-telemetry#5125

Assisted-by: Claude

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…o samplers (open-telemetry#5032)

* opentelemetry-instrumentation-wsgi: expose captured request headers to samplers

* changelog: use PR number 5032 for WSGI sampling fix

* opentelemetry-instrumentation-wsgi: skip unconfigured request header collection

* opentelemetry-instrumentation-wsgi: collect captured headers with request attributes

* opentelemetry-instrumentation-wsgi: keep public attribute dict annotations unchanged

The docs build failed because sphinx-autodoc-typehints could not resolve the
`AnyValue` forward reference inside `AttributeValue` when it appeared in the
public `collect_request_attributes` and `add_response_attributes` signatures.
Restore the pre-existing annotations so the change only adds the
`capture_custom_headers` behavior.

Assisted-by: Claude Code

* opentelemetry-instrumentation-wsgi: use CapturingSampler from test utils

Replace the test-local request header sampler with the shared
CapturingSampler added to opentelemetry-test-utils in
open-telemetry/opentelemetry-python#5681.

Assisted-by: Claude Fable 5.1

* opentelemetry-instrumentation-wsgi: gate header capture on the current span at the call site

Decide whether to pass capture_custom_headers in OpenTelemetryMiddleware,
where the SERVER span is created, instead of inside
collect_request_attributes. The helper now only honors the flag.

Assisted-by: Claude Opus 5.5

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…y#5151)

* opamp: bump supported protobuf to < 8 as the exporters

* Add changelog

* Really rebuild latest requirements
)

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
…open-telemetry#5134)

* prometheus-remote-write: fix inverted insecure_skip_verify TLS option

`tls_config["insecure_skip_verify"]` was passed straight through as the
`verify` argument of `requests.post`, inverting its meaning:

- `insecure_skip_verify: True` kept certificate verification enabled
- `insecure_skip_verify: False` silently disabled certificate verification

Negate the value so it matches the Prometheus `remote_write` tls_config
semantics the option is named after, and add a regression test for both
values.

Fixes open-telemetry#1467

* Add changelog fragment

* Update changelog fragment

---------

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
… name to db.operation.name (open-telemetry#5043)

* opentelemetry-instrumentation-sqlalchemy: stop appending the database name to db.operation.name and db.operation

* Rename changelog entry to the PR number

* Use a walrus operator when building the span name

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…etry#5073)

* Record headers before sampling in django instrumentation

* changelog

* cleanup

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…open-telemetry#4958)

* pull_request_template: simplify by removing some not so used sections

How has this been tested is often a list of tox targets, CI will tell
the truth.
Move Does This PR Require a Core Repo Change? to a checklist entry since
it's not used so often.
Simplify the checklist since again CI will the truth.

* Update .github/pull_request_template.md

---------

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…en-telemetry#4869)

* Add baggage propagation tests for Flask and WSGI instrumentations

The Flask instrumentation and the WSGI OpenTelemetryMiddleware extract
W3C baggage from incoming request headers (via the default composite
propagator used by _start_internal_or_server_span) and make it active
for the duration of the request, but this behavior had no test
coverage.

Add tests asserting that baggage entries from the incoming `baggage`
header (including percent-encoded values) are available via
baggage.get_all() inside the wrapped WSGI app / Flask handler, and
that the extracted context is detached once the request ends.

Tests-only change, no functional changes.

Fixes open-telemetry#268

Signed-off-by: Jojin <jojin.kb@gmail.com>

* Apply batched suggestions from code review

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>

remove unused import

---------

Signed-off-by: Jojin <jojin.kb@gmail.com>
Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
* fix(aiopg): honor instrumentation suppression

Assisted-by: Codex (GPT-6)

* chore(aiopg): number changelog for PR 5175

Assisted-by: Codex (GPT-6)
…match them with regexes (open-telemetry#5170)

Use SanitizeValue from opentelemetry-util-http for the captured request
and response headers, as the other HTTP server instrumentations do, so
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS is applied and
header names are matched case-insensitively as regular expressions.

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
… closure ThreadPoolExecutor.submit forwards so the submitted callable keeps its own metadata (open-telemetry#5011)

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…emetry#5082)

* aws-lambda: Mark HTTP server error responses as span errors

A returned HTTP 5xx response should be observable as a server-span error,
while preserving the handler response and ordinary 4xx span status.

* aws-lambda: Add release note for HTTP server error status

Record the observable span-status correction in the release changelog.

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…drop support for SQLAlchemy < 1.4 (open-telemetry#5120)

* opentelemetry-instrumentation-sqlalchemy: Support SQLAlchemy 2.1 and drop support for SQLAlchemy < 1.4

* fix changelog fragment number

* address PR comments
…en-telemetry#5159)

* Capture headers before sampling in aiohttp-server instrumentation

* changelog
…ions on PRs (open-telemetry#5101)

* misc: update CI to only run tests with oldest and latest CPython versions on PRs

* make pypy tests run again for PR checks

* re-generate workflows
…etry#5160)

* Capture headers before sampling in falcon instrumentation

* changelog

* cleanup
…try#5161)

* Capture headers before sampling in flask instrumentation

* changelog

* cleanup
…metry#5162)

* Capture headers before sampling in pyramid instrumentation

* changelog

* cleanup
…metry#5163)

* Capture headers before sampling in tornado instrumentation

* changelog
open-telemetry#4934)

* fix(dbapi): avoid IndexError in get_operation_name for comment/whitespace-only statements

A statement that is truthy but has no tokens left after leading-comment or
whitespace stripping (e.g. a comment-only or whitespace-only query) made
`.split()[0]` raise IndexError, which propagates out of the instrumented
execute call. Guard the result the same way the `_Template` branch already
does and return an empty operation name instead. Adds a regression test.

Signed-off-by: Atishyy27 <142108881+Atishyy27@users.noreply.github.com>

* address review: move changelog to .changelog fragment, add subTest to empty-token test

Signed-off-by: Atishyy27 <142108881+Atishyy27@users.noreply.github.com>

* test(dbapi): assert and clear within the same subTest iteration

Per xrmx's review on open-telemetry#4934: the test executed both regression cases in one
loop, then asserted span count/names in a second pass after the loop ended,
so a subTest failure wouldn't isolate which case actually failed. Moves the
assertion inside each subTest and clears the exporter per iteration, so each
case checks exactly its own single span.

* style(dbapi): ruff format the regression test

---------

Signed-off-by: Atishyy27 <142108881+Atishyy27@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…ry#5158)

* Capture headers before sampling in ASGI instrumentation

* changelog

* Fix changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…pen-telemetry#5169)

delete_message_wrapper_batch iterated kwargs.get("Entries") with no
guard, so a call without Entries raised TypeError from inside the
instrumentation where botocore raises ParamValidationError. Call
wrapped first when Entries is missing or empty, as send_batch_wrapper
already does.

Fixes open-telemetry#5061

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…telemetry#5141)

* fix(sdk-extension-aws): report Lambda faas.max_memory in bytes

* fix(sdk-extension-aws): Add changelog for reporting faas.max_memory in bytes

* refactor(sdk-extension-aws): emphasizes the changelog that faas.max_memory fix is a breaking change

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…y#5197)

Bumps [certifi](https://github.com/certifi/python-certifi) from 2026.6.17 to 2026.10.19.
- [Commits](certifi/python-certifi@2026.06.17...2026.10.19)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.19
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ry#5063)

* sqlalchemy: opt-in db.client.connection.count via OTEL_SEMCONV_STABILITY_OPT_IN Fixes open-telemetry#5060

* Fix changelog PR number and pylint no-self-use

* Document connection.count semconv opt-in

* sqlalchemy: modernize db.client.connection.count metric

Drop the OTEL_SEMCONV_STABILITY_OPT_IN gating per the maintainer decision in open-telemetry#1158. Always emit db.client.connection.count with db.client.connection.state / db.client.connection.pool.name, replacing the deprecated db.client.connections.usage metric.

* sqlalchemy: update postgres docker metric test to db.client.connection.count

* sqlalchemy: generalize connection metrics docstring per review

* Add breaking change notice for SQLAlchemy instrumentation

This change introduces a breaking change notice for the metric update.

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
xrmx and others added 20 commits October 23, 2026 14:57
…5105)

Normalize known Exchange and Queue names and skip empty names while preserving valid span attribute values.

Assisted-by: OpenCode (openai/gpt-6-luna-pro)

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…e-only statements (open-telemetry#5065)

* fix(tortoiseorm): avoid IndexError in _do_execute for empty/whitespace-only statements

* chore: add changelog fragment

* fix(tortoiseorm): fall back to db name or dialect when statement has no tokens

Fallback suggested in review.

Co-authored-by: Henry Chen <108824346+henry3260@users.noreply.github.com>

* fix(tortoiseorm): strip leading comment before taking span name

A statement starting with /* ... */ produced a span named /*. Use the same regex as dbapi, asyncpg, psycopg and sqlalchemy.

---------

Co-authored-by: Henry Chen <108824346+henry3260@users.noreply.github.com>
Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…3.14 (open-telemetry#5207)

* opamp-client: vendor a backported uuidv7 implementation from CPython

The OpAMP spec mandates to use uuid7. Python implements in the stdlib
since 3.14.
Currently the OpAMP client depends on `uuid-utils`, a python library
wrapping a rust library that implements all the uuid implementations
for just uuid7. The problem with this is that being a binary package
not built with the limited api (abi3) on k8s operator environments
this is another reason that we may need to rebuild a custom image
since the autoinstrumentation image may be built on a different
python version.
There are other pure python packages available but was not able to
find one that stucks as a strong reputable dependency.
I've opened an issue to `uuid-utils` on asking to build wheels using
the limited api but given we need just a subset of the features
shipping our own implementation may be more sensible.

The implementation is the CPython one taken from 3.14 branch at
a2341ad86bd6d4361f19550eefb1e7c8b006f37a, updated to work on
Python 3.10:
- int.from_bytes with explicit byteorder
- UUID(int=) instead of UUID._from_int

* Add changelog

* Please pylint

* Add exception to license check

* Use stdlib uuid7 from stdlib if available

---------

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
vcrpy 9.0.0 and 9.1.0 were released on 2026-10-25 and both import
HTTPHeaderDict from the top level of urllib3, where it exists only in
urllib3 2. All four botocore test requirement files pin urllib3==1.26.19, in
which the class is reachable as urllib3._collections.HTTPHeaderDict and is not
re-exported, so every test in test_botocore_bedrock.py errors during setup with

    ImportError: cannot import name 'HTTPHeaderDict' from 'urllib3'

No resolver prevents this. vcrpy declares urllib3 only under its tests extra,
so an ordinary install of vcrpy carries no urllib3 constraint at all, and the
distribution is otherwise pulled in unpinned through pytest-vcr.

test-requirements-2.txt and test-requirements-3.txt already pin vcrpy==8.3.0
and their jobs pass. This gives test-requirements-0.txt and
test-requirements-1.txt the same pin, so the four files agree.

Raising urllib3 to a 2.x release would also fix it and is the better long-term
answer, but it changes behaviour the recorded cassettes and the other pinned
distributions may depend on, so it belongs in its own change.
The changelog job excludes otelbot[bot] but says nothing about
dependabot[bot]. Dependabot writes no changelog fragment and does not
apply the Skip Changelog label to its own pull requests, so the check
fails on every one of them and stays failed until a maintainer applies
the label by hand.

16 of the 17 open Dependabot pull requests are failing the check, the
oldest since 22 July 2026, and 21 of the 22 merged ones carry a
hand-applied Skip Changelog label.

.github/workflows/check-links.yml already excludes both accounts.

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…pen-telemetry#5210)

# Description

Update `RELEASING.md` to instruct maintainers to reserve package names through the PyPI organization UI rather than releasing a dev version. This aligns with the instructions in `opentelemetry-python-genai`.

## Type of change

- [x] This change requires a documentation update

# Checklist:

See [contributing.md](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md) for styleguide, changelog guidelines, and more.

- [x] 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 tox environments
- [ ] This requires the following PR in core:

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
…rtoiseorm (open-telemetry#5232)

* fix(tortoiseorm): declare pydantic in _instruments

The pyproject.toml instruments extra lists both tortoise-orm and
pydantic, and bootstrap_gen.py carries both, but package.py listed only
tortoise-orm. The runtime dependency check in BaseInstrumentor.instrument
reads package.py, so it never verified pydantic even though the
instrumentation wraps tortoise.contrib.pydantic.base.PydanticModel.

The two declarations now agree.

* fix(botocore): match the instruments spacing in package.py

pyproject.toml writes "botocore ~= 1.0" and "aiobotocore >= 2.0, < 4.0"
while package.py wrote the same two requirements with no spaces. The
requirements are equivalent, but the strings are not, and
bootstrap_gen.py reproduces them verbatim.

* chore: add the changelog fragment for 5232
)

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
…lt (open-telemetry#5157)

* fix(opentelemetry-instrumentation-dbapi): emit database metrics by default

* chore(opentelemetry-instrumentation-dbapi): number changelog for pr 5157

* test(opentelemetry-instrumentation-aiopg): expect database metrics by default
…pen-telemetry#5107)

* opamp-client: build queued messages when they are sent

The agent built each message when it was queued, so it carried the
sequence number from that moment. Messages queued behind a request that
was still in flight repeated its sequence number, and a retried message
resent its old one after the counter had moved on.

Heartbeats, the connection message and full state reports are now
queued as functions that the worker calls right before each attempt.
OpAMPAgent.send() accepts such a function too; bytes are still sent
unchanged. A job whose message can't be built is logged and dropped.

Fixes open-telemetry#5097

* Add changelog entry

* opamp-client: build each queued message once

A message now takes its sequence number when it is built, instead of
the client counting every send attempt, and the worker builds a job's
message once and resends the same bytes on retries, as opamp-go does.

The connection message is built in start() again, so a builder error
is raised to the caller. The full state report the server asks for is
queued after on_message, so it goes after any message the callback
builds and sends.

* opamp-client: don't call the job callback when the message can't be built

Also document in send() that a function is preferred over bytes.

* opamp-client: set the sequence number and instance UID when a message is sent

Queue AgentToServer messages instead of bytes or functions, as opamp-go
does. The build_*_message() methods return messages, and
OpAMPClient.prepare_message() sets the current instance UID and the next
sequence number on a copy just before the message is first sent; retries
send the same bytes. Bytes passed to OpAMPAgent.send() are decoded and
prepared the same way, so callers that still send bytes are numbered in
the order messages are sent too.

Callers that build a message in on_message and send it, as distros do
with the remote config status, no longer get a number lower than
heartbeats queued before it.

* opamp-client: prepare messages explicitly before sending

Address review feedback and document generated protobuf types for Sphinx.

Assisted-by: OpenAI Codex

* opamp-client: snapshot queued messages and document direct sends

Copy mutable protobuf payloads at enqueue time while preparing UID and sequence number at send time. Add regression coverage and ensure new threaded tests clean up on failure.

Assisted-by: OpenAI Codex

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
…open-telemetry#4827)

* fix(celery): populate origin and hostname as distinct span attributes

* test(celery): cover origin-only context and clarify changelog

Add a test asserting that a context with only origin sets celery.origin and does not set celery.hostname. Reword the changelog entry to describe the user-visible change on worker spans.

---------

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
… metrics tests (open-telemetry#5016)

* celery: wait for the recorded metric instead of result.ready() in the metrics tests

* celery: re-enable the metrics uninstrument test on PyPy and add a changelog entry

---------

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…on raises (open-telemetry#5031)

* opentelemetry-instrumentation-asgi: set error.type when the application raises

The __call__ path wrapped the application in try/finally with no except
clause, so an exception that escaped it left both the server span and the
http.server.request.duration metric without error.type, even while
trace.use_span had already set the span status to ERROR. The attribute is
Conditionally Required "If request has ended with an error", and an escaping
exception is that case.

The one precondition is a clobber guard, not a filter on which failures
count. _set_status already derives error.type from an error status code into
the same attribute dict, so a 5xx response carries "500" today, and note [4]
on the attribute accepts either the status code or "an exception type (if
thrown)" once a status was sent. Skipping the write when error.type is
already present keeps the status-derived value, so a streaming response that
sends 5xx, emits more_body chunks and then fails keeps reporting the code
existing dashboards query on. Nothing else is skipped. A status code in the
dict is not by itself a reason to stay silent: http-spans.md illustrates a
connection dropped before the response body was sent with a server span
carrying status 201 and error.type together.

asyncio.CancelledError needs no exclusion: it derives from BaseException, so
`except Exception` never sees it, the same line trace.use_span draws.

A disconnect is reported like any other exception. Starlette's
ClientDisconnect is an ordinary Exception subclass, and no predicate
available here separates it out: ASGI sends http.disconnect whenever receive
is called after a response has been sent, and websocket.disconnect when the
server closes the connection as well as when the client does, so having seen
one does not mean the peer went away, let alone that it caused this
exception. The conventions' only not-an-error carve-out is scoped to HTTP
client instrumentation detecting intentional caller cancellation. The wsgi
instrumentation in this repo reports error.type for every escaping exception
with no exclusions at all; this adds only the clobber guard on top of that.

Writing the attribute inline rather than through this module's
set_status_code helper is deliberate. The helper carries only a status code,
so routing through it means passing the exception qualname as one, the abuse
open-telemetry#2719 was rejected for, and its negative-status branch would also replace the
span status description trace.use_span already set from the exception with
"Non-integer HTTP status: ValueError".

error.type is listed in _server_duration_attrs_new, so the single assignment
reaches http.server.request.duration, and the request and response body size
histograms derived from the same dict pick it up whenever a content-length
made them fire.

Two limits are left as they are, both shared with the wsgi instrumentation.
An application that completes a response and then raises has already had its
span ended by otel_send, so only the metric records the attribute. And an
ExceptionGroup reports error.type="ExceptionGroup" for every distinct
underlying failure; unwrapping it is a separate policy question that affects
every instrumentation reporting error.type.

Assisted-by: Claude Opus 5

* chore: name the changelog fragment after the pull request

The changelog workflow rejects any filename that is not the pull request number,
which is not knowable until the pull request exists.

Assisted-by: Claude Opus 5

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…es (open-telemetry#5077)

* fix(logging): stop duplicating injected trace context in log attributes

LoggingInstrumentor injects otelSpanID, otelTraceID, otelTraceSampled
and otelServiceName onto every stdlib LogRecord so formatters can render
them. LoggingHandler then copies every non-reserved record attribute into
the emitted LogRecord, so those four are exported as attributes even
though the same context is already present in the first-class trace_id,
span_id and trace_flags fields and the service name is on the resource.

Pop them in _get_attributes, following the convention established for
event_name, so the attributes stay on the stdlib record for formatters
while the exported record carries the context only once.

* fix(logging): stop duplicating injected trace context in log attributes

LoggingInstrumentor injects otelSpanID, otelTraceID, otelTraceSampled
and otelServiceName onto every stdlib LogRecord so formatters can render
them. LoggingHandler then copies every non-reserved record attribute into
the emitted LogRecord, so those four are exported as attributes even
though the same context is already present in the first-class trace_id,
span_id and trace_flags fields and the service name is on the resource.

Pop them in _get_attributes, following the convention established for
event_name, so the attributes stay on the stdlib record for formatters
while the exported record carries the context only once.

* chore: add changelog fragment for open-telemetry#5077

* fix(logging): filter trace context during attribute construction

Assisted-by: Claude

* test(logging): assert trace context values and reuse the shared tuple

Assisted-by: Claude

---------

Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
…y#5088)

* fix(asyncpg): accept query arguments passed by keyword

Assisted-by: OpenAI Codex
Signed-off-by: git-jxj <65210887+git-jxj@users.noreply.github.com>

* chore(asyncpg): number changelog fragment for PR 5088

Assisted-by: OpenAI Codex
Signed-off-by: git-jxj <65210887+git-jxj@users.noreply.github.com>

* fix(asyncpg): extract parameters only when capture is enabled

Assisted-by: OpenAI Codex

---------

Signed-off-by: git-jxj <65210887+git-jxj@users.noreply.github.com>
Co-authored-by: Emídio <9735060+emdneto@users.noreply.github.com>
Implements the patchgen design (design/patchgen/design.md):

- scripts/patchgen: `lock` (resolves versions from PyPI, introspects
  target signatures in throwaway uv venvs, writes patches.lock.json),
  `generate` (hermetic jinja2 rendering of typed Args dataclasses,
  wrapper Protocols and instrument/uninstrument/instrument_instance
  lifecycle functions) and `check` / `report` (verifies generated
  modules and reports Any type gaps). Run with
  `uv run scripts/patchgen/cli.py`.
- opentelemetry.instrumentation._patching: runtime support used by the
  generated modules (transactional apply/unwind, instance-scope
  patching, shared bind_wrapper dispatcher, version-range selection,
  lock/signature mismatch reporting, rate-limited bind failure logging,
  OTEL_PYTHON_PATCH_STRICT).
- Unit tests for the runtime and the generator.

Assisted-by: Jetski
- Add patches.yaml, patches.lock.json, and generated _patches.py for HTTPConnectionPool.urlopen
- Rewrite wrapper in __init__.py against HttpconnectionpoolUrlopenWrapper and use args.replace_raw(headers=headers)
- Add opentelemetry-instrumentation-urllib3[instruments] to [testenv:typecheck] in tox.ini

Assisted-by: Jetski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.