Skip to content

Commit 79f6814

Browse files
authored
Merge branch 'main' into langchain-workflow-type
2 parents 02c0f37 + 3c7c592 commit 79f6814

103 files changed

Lines changed: 7372 additions & 1097 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
- name: Install tox
6969
run: pip install tox-uv
7070

71+
{%- if job_data == "docker-tests" %}
72+
73+
- name: Install Microsoft SQL ODBC driver
74+
run: sudo apt update -y && ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
75+
{%- endif %}
76+
7177
- name: Run tests
7278
run: tox -e {{ job_data }}
7379
{%- if job_data == "generate-workflows" %}

.github/workflows/misc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
- name: Install tox
6060
run: pip install tox-uv
6161

62+
- name: Install Microsoft SQL ODBC driver
63+
run: sudo apt update -y && ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
64+
6265
- name: Run tests
6366
run: tox -e docker-tests
6467

.github/workflows/test.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,6 @@ jobs:
214214
- name: Run tests
215215
run: tox -e py314-test-instrumentation-openai-v2-latest -- -ra
216216

217-
py313-test-instrumentation-openai-v2-pydantic1_ubuntu-latest:
218-
name: instrumentation-openai-v2-pydantic1 3.13 Ubuntu
219-
runs-on: ubuntu-latest
220-
timeout-minutes: 30
221-
steps:
222-
- name: Checkout repo @ SHA - ${{ github.sha }}
223-
uses: actions/checkout@v4
224-
225-
- name: Set up Python 3.13
226-
uses: actions/setup-python@v5
227-
with:
228-
python-version: "3.13"
229-
230-
- name: Install tox
231-
run: pip install tox-uv
232-
233-
- name: Run tests
234-
run: tox -e py313-test-instrumentation-openai-v2-pydantic1 -- -ra
235-
236217
pypy3-test-instrumentation-openai-v2-oldest_ubuntu-latest:
237218
name: instrumentation-openai-v2-oldest pypy-3.10 Ubuntu
238219
runs-on: ubuntu-latest

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ uv run tox -e typecheck
6565
- The monorepo uses `uv` workspaces.
6666
- `tox.ini` defines the test matrix - check it for available test environments.
6767
- Do not add `type: ignore` comments. If a type error arises, solve it properly or write a follow-up plan to address it in another PR.
68+
- When a file uses `from __future__ import annotations`, do not quote type annotations just to
69+
avoid forward references. Keep quotes only for expressions still evaluated at runtime, such as
70+
`typing.cast(...)`, unless the referenced type is imported at runtime.
6871
- Whenever applicable, all code changes should have tests that actually validate the changes.
6972

7073
## Instrumentation rules

CHANGELOG.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
## Unreleased
1313

1414
### Added
15+
1516
- Add `BaggageLogProcessor` to `opentelemetry-processor-baggage`
1617
([#4371](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4371))
17-
1818
- `opentelemetry-instrumentation-system-metrics`: Add support for `process.disk.io` metric in system-metrics instrumentation
19-
([#4397](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4397))
19+
([#4397](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4397))
2020
- Switch to SPDX license headers and add CI enforcement
2121
([#4533](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4533))
2222
- Bump `pylint` to `4.0.5`
@@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
([#3839](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3839))
3232
- `opentelemetry-exporter-richconsole`: Add support for suppressing resource information
3333
([#3898](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3898))
34+
- `opentelemetry-instrumentation`: Add experimental metrics attributes Labeler utility
35+
([#4288](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4288))
3436

3537
### Fixed
3638

@@ -46,11 +48,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4648
([#4360](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4360))
4749
- `opentelemetry-instrumentation-aiohttp-server`: Use `canonical` attribute of the `Resource` as a span name
4850
([#3896](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3896))
51+
- `docker-tests`: Don't require sudo, debian based distro and MS SQL ODBC driver to run locally. Instead require docker and unixodbc
52+
([#4478](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4478))
53+
- Refactor unit tests to allow for population of the random trace id flag in the `traceparent` header
54+
([#4030](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4030))
55+
- `opentelemetry-instrumentation-fastapi`: Fix `FastAPI` instrumentation to correctly trace `BackgroundTasks` by wrapping their execution in a dedicated span, ensuring proper parent-child relationships and accurate trace timing
56+
([#4368](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4368))
57+
- `opentelemetry-instrumentation-celery`: Coerce timelimit values to strings in `set_attributes_from_context()` to prevent mixed-type span attribute warning
58+
([#4361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4361))
59+
- `opentelemetry-instrumentation-mysqlclient`: Update unit tests to properly validate trace context trace flag values.
60+
([#4560](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4560))
61+
62+
### Fixed
63+
64+
- `opentelemetry-instrumentation-confluent-kafka`: Populate `server.address` and `server.port` span attributes from the producer/consumer `bootstrap.servers` config; previously `KafkaPropertiesExtractor.extract_bootstrap_servers` was defined but never called
65+
([#4423](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4423))
4966

5067
### Breaking changes
5168

5269
- Drop Python 3.9 support
5370
([#4412](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4412))
71+
- `opentelemetry-instrumentation-logging`: Use `LogRecord.getMessage()` to format and extract each log record's body text to more closely match the expected usage of the logging system. As a result, all OTel log record bodies are now always strings.
72+
Previously, if `LogRecord.msg` (which contains the format string) was set to a non-string object (e.g. `logger.warning(some_dict)`), the object was exported as-is to the OTLP body field. Now, `LogRecord.getMessage()` will convert it to to a string.
73+
If you are passing in non-strings as the format string argument and your backend is expecting them as-is, you will need to update accordingly.
74+
([#4372](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4372))
5475

5576
## Version 1.41.0/0.62b0 (2026-04-09)
5677

@@ -70,13 +91,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7091
([#4049](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4049))
7192
- `opentelemetry-instrumentation-sqlalchemy`: implement new semantic convention opt-in migration
7293
([#4110](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4110))
73-
- `opentelemetry-instrumentation`: Add experimental metrics attributes Labeler utility
74-
([#4288](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4288))
7594

7695
### Fixed
7796

78-
- `opentelemetry-instrumentation-celery`: Coerce timelimit values to strings in `set_attributes_from_context()` to prevent mixed-type span attribute warning
79-
([#4361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4361))
8097
- `opentelemetry-docker-tests`: Replace deprecated `SpanAttributes` from `opentelemetry.semconv.trace` with `opentelemetry.semconv._incubating.attributes`
8198
([#4339](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4339))
8299
- `opentelemetry-instrumentation-confluent-kafka`: Skip `recv` span creation when `poll()` returns no message or `consume()` returns an empty list, avoiding empty spans on idle polls

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,21 @@ Instrumentations that relate to [Generative AI](https://opentelemetry.io/docs/sp
406406

407407
OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.
408408

409+
### Use of AI coding assistants
410+
411+
AI coding assistants can be valuable tools for contributors. They may help with understanding the codebase, drafting changes, writing tests and improving documentation. Contributors are welcome to use AI tools as a part of their contribution workflow.
412+
413+
However, contributors remain responsible for the quality and correctness of their contributions. AI generated material must be carefully reviewed, validated and adapted by the contributor before being submitted to the project.
414+
415+
Maintainers reserve the right to close pull requests or other contributions that appear to have been primarily generated by AI with little or no meaningful review from the contributor. This includes, but is not limited to:
416+
417+
- Opening a large number of low quality pull requests in a short period of time.
418+
- Submitting changes that are incomplete, incorrect, unrelated to the issue or not aligned with project conventions.
419+
- Posting review replies, issue comments or other responses that appear to be AI generated and/or do not meaningfully address maintainer feedback.
420+
- Submitting pull requests that require maintainers to spend significant time correcting or explaining basic issues that should have been caught by the contributor before submission.
421+
422+
This policy is intended to reduce unnecessary burden on maintainers and ensure that AI tools are used responsibly in support of high quality contributions.
423+
409424
### Guidelines for native OpenTelemetry instrumentation
410425

411426
The preferred approach to supporting instrumentation of a tool or framework is native OpenTelemetry instrumentation. Compared to adding a new instrumentation library to this community repository, native instrumentation is better for:

instrumentation-genai/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ except Exception as exc:
6161
raise
6262
```
6363

64+
Content capture decisions must come from the shared handler, not from instrumentation-local
65+
environment checks or duplicated helper logic. Evaluate the handler's content-capture API once
66+
when creating wrappers (for example, `capture_content = handler.should_capture_content()`) and
67+
pass that value through invocation/request helpers.
68+
6469
## 4. Semantic conventions
6570

6671
Attributes, spans, events, and metrics follow the

instrumentation-genai/opentelemetry-instrumentation-anthropic/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
### Added
1616

17+
- Add instrumentation for Anthropic `Messages.stream()` helper method
18+
([#4499](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4499))
1719
- Add async Anthropic message stream wrappers and manager wrappers, with wrapper
1820
tests ([#4346](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4346))
1921
- `AsyncMessagesStreamWrapper` for async message stream telemetry

instrumentation-genai/opentelemetry-instrumentation-anthropic/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ classifiers = [
2525
"Programming Language :: Python :: 3.14",
2626
]
2727
dependencies = [
28-
"opentelemetry-api ~= 1.39",
29-
"opentelemetry-instrumentation ~= 0.60b0",
30-
"opentelemetry-semantic-conventions ~= 0.60b0",
28+
"opentelemetry-api ~= 1.40",
29+
"opentelemetry-instrumentation ~= 0.61b0",
30+
"opentelemetry-semantic-conventions ~= 0.61b0",
3131
"opentelemetry-util-genai >= 0.4b0.dev, <0.5b0",
3232
]
3333

instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/__init__.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@
4242
wrap_function_wrapper, # pyright: ignore[reportUnknownVariableType]
4343
)
4444

45-
from opentelemetry.instrumentation.anthropic.package import _instruments
46-
from opentelemetry.instrumentation.anthropic.patch import (
47-
messages_create,
48-
)
4945
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
5046
from opentelemetry.instrumentation.utils import unwrap
5147
from opentelemetry.util.genai.handler import TelemetryHandler
5248

49+
from .package import _instruments
50+
from .patch import (
51+
messages_create,
52+
messages_stream,
53+
)
54+
5355

5456
class AnthropicInstrumentor(BaseInstrumentor):
5557
"""An instrumentor for the Anthropic Python SDK.
@@ -88,12 +90,17 @@ def _instrument(self, **kwargs: Any) -> None:
8890
logger_provider=logger_provider,
8991
)
9092

91-
# Patch Messages.create
93+
# Patch Messages.create and Messages.stream
9294
wrap_function_wrapper(
9395
"anthropic.resources.messages",
9496
"Messages.create",
9597
messages_create(handler),
9698
)
99+
wrap_function_wrapper(
100+
"anthropic.resources.messages",
101+
"Messages.stream",
102+
messages_stream(handler),
103+
)
97104

98105
def _uninstrument(self, **kwargs: Any) -> None:
99106
"""Disable Anthropic instrumentation.
@@ -106,3 +113,7 @@ def _uninstrument(self, **kwargs: Any) -> None:
106113
anthropic.resources.messages.Messages, # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType,reportUnknownArgumentType]
107114
"create",
108115
)
116+
unwrap(
117+
anthropic.resources.messages.Messages, # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType,reportUnknownArgumentType]
118+
"stream",
119+
)

0 commit comments

Comments
 (0)