* Add support for wrapt 2.x
- Update wrapt version constraint from '>=1.0.0, <2.0.0' to '>=1.0.0' in all affected packages
- Replace ObjectProxy with BaseObjectProxy where iteration support is not needed
- Add fallback import for wrapt 1.x compatibility (ObjectProxy as BaseObjectProxy)
- Keep ObjectProxy usage in classes that implement __iter__ (botocore, aiopg)
- Update CHANGELOG.md
This change maintains backward compatibility with wrapt 1.x while enabling
support for wrapt 2.x. BaseObjectProxy is the new base class in wrapt 2.x,
while ObjectProxy is now a subclass that adds __iter__() support.
Fixes#3903
Related to #3930 and #4082
* Restructure wrapt test requirements
- Remove wrapt from base test-requirements.txt (installed via pyproject.toml)
- Remove Deprecated from base test-requirements.txt (version conflicts with wrapt 2.x)
- Create test-requirements-wrapt1.txt with wrapt<2.0.0 and Deprecated==1.2.14
- Create test-requirements-wrapt2.txt with wrapt>=2.0.0 and Deprecated>=1.2.18
- Update tox.ini to use requirements files instead of factor-based deps
- Add Deprecated to lint environment deps
This follows the pattern used by other packages (botocore, httpx) and
resolves dependency conflicts where Deprecated 1.2.14 requires wrapt<2.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: Resolve conflicts and add Wrapt 3 as upper bound
* Add wrapt 1.x/2.x test matrix for all ObjectProxy-using instrumentations
Extend the wrapt1/wrapt2 test matrix to all instrumentations that use
wrapt.ObjectProxy or wrapt.BaseObjectProxy: botocore, dbapi, grpc, pika,
aiopg, httpx, and asyncpg.
Changes:
- tox.ini: Add {wrapt1,wrapt2} factor to envlist for all 7 packages;
update deps to reference per-version test-requirements files
- botocore/pyproject.toml: Add missing wrapt dependency (>= 1.0.0, < 3.0.0)
- All base test-requirements files: Remove pinned wrapt== and Deprecated==
- New test-requirements-wrapt1.txt / test-requirements-wrapt2.txt files for
each package (using Deprecated>=1.2.18 for wrapt2 to avoid conflict with
Deprecated==1.2.14 which requires wrapt<2)
- Regenerate GitHub Actions workflows (including new test_3.yml due to
expanded job count)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix CI failures: ruff formatting and lint wrapt version pin
- utils.py: reformat multi-condition if statement to satisfy ruff line
length requirement (fixes generate/precommit CI jobs)
- tox.ini: pin wrapt>=1.0.0,<2.0.0 for lint envs of botocore, dbapi,
grpc, and sio-pika; with wrapt 1.x removed from base test-requirements,
lint envs were getting wrapt 2.x which caused pylint no-member errors
on __wrapped__ (a C-extension attribute not visible to static analysis)
Also add Deprecated==1.2.14 to same lint envs for consistency
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix remaining CI failures: unused imports and uv.lock
- dbapi/__init__.py: remove unused bare 'import wrapt' (F401); the
compat shim imports BaseObjectProxy directly from wrapt
- grpc/_aio_server.py: remove unused 'import wrapt' (F401) and fix
import ordering (I001) flagged by ruff pre-commit hook
- uv.lock: regenerate after adding wrapt dependency to botocore
pyproject.toml
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix aiopg lint wrapt pin, uv.lock format, and ruff blank lines
- tox.ini: pin wrapt>=1.0.0,<2.0.0 + Deprecated==1.2.14 for
lint-instrumentation-aiopg; aiopg source uses __wrapped__ heavily and
pylint's no-member error appeared when wrapt 2.x was installed
- uv.lock: regenerate using pre-commit hook (uv v0.9.30) to fix
trailing-slash format on registry URLs
- httpx/test_httpx_integration.py: add blank line before try/except
block (ruff I001/E303 formatting fix)
- pika/utils.py: add blank line before try/except block (same ruff fix)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix pylint E0611: disable no-name-in-module for BaseObjectProxy compat shim
pylint with wrapt 1.x installed reports E0611 ('No name BaseObjectProxy
in module wrapt') when it sees the try/except ImportError compat shim,
even though the except branch provides a fallback. Add a per-line
pylint disable comment to suppress this false positive.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix asyncpg test: use BaseObjectProxy compat shim for wrapt 2.x
In wrapt 2.x, BoundFunctionWrapper no longer subclasses ObjectProxy
(it subclasses BaseObjectProxy instead). Update the test to use
the compat shim so isinstance checks pass with both wrapt 1.x and 2.x.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address PR review comments: add wrapt 2.0.0+ comments and fix CHANGELOG
- Add '# wrapt 2.0.0+' comment above BaseObjectProxy import in all
try/except compat shim blocks to clarify why the pattern is used
- Fix CHANGELOG.md PR link from #XXXX to #4203
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* chore: Update changelog and workflows
* Apply suggestions from code review
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* fix: Update workflows again
* Apply suggestions from code review
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Remove Deprecated version pins from test-requirements and tox.ini
Deprecated>=1.2.14 was pinned because Deprecated==1.2.14 requires
wrapt<2. Since pip automatically resolves compatible versions based
on the wrapt constraint in each test env, explicit Deprecated pins
are unnecessary. Remove them from all test-requirements-wrapt*.txt
files and from lint env deps in tox.ini.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove stale .orig file leftover from rebase
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move lint env wrapt pins from tox.ini into test-requirements files
All dependencies should be managed via requirements.txt files rather
than inline in tox.ini. Move wrapt>=1.0.0,<2.0.0 pins for lint
environments into their respective test-requirements files:
- instrumentation-grpc/test-requirements-1.txt
- instrumentation-botocore/test-requirements-1.txt
- instrumentation-dbapi/test-requirements.txt
- instrumentation-aiopg/test-requirements.txt
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Apply suggestions from code review
* Update instrumentation/opentelemetry-instrumentation-botocore/test-requirements-1.txt
* Update instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt
* Update instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt
* Update instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt
* Address latest PR feedback: botocore compat shim, exact wrapt versions, lint env refs
- botocore/bedrock_utils.py: apply BaseObjectProxy compat shim to
ConverseStreamWrapper and InvokeModelWithResponseStreamWrapper (both
classes define __iter__ so BaseObjectProxy is correct)
- All test-requirements-wrapt1.txt: pin wrapt==1.17.3 (exact version)
- All test-requirements-wrapt2.txt: pin wrapt==2.1.2 (exact version)
- tox.ini lint envs: switch to -wrapt2.txt files so lint runs with
wrapt 2.x; remove wrapt pin from base test-requirements files
(grpc/test-requirements-1.txt, botocore/test-requirements-1.txt,
dbapi/test-requirements.txt, aiopg/test-requirements.txt)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add pylint disable=no-member for __wrapped__ and abstract-method usages
Add pylint: disable=no-member to all class definitions and usages of
__wrapped__ that are invisible to pylint when using wrapt's C extension
proxy types (BaseObjectProxy/ObjectProxy).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* increase stale action operations-per-run to 500
Assisted-by: Claude Sonnet 4.6
* add changelog entry for stale ops-per-run increase
Assisted-by: Claude Sonnet 4.6
* add TODO to revert once backlog is cleaned up
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Add response wrappers for OpenAI Responses API streams.
* Enhance docstrings for ResponseStreamWrapper and ResponseStreamManagerWrapper to include references to the OpenAI SDK source. This improves clarity on the functionality and origin of the wrappers.
* Add wrappers for OpenAI Responses API streams and response stream managers in CHANGELOG.md
* Refactor response handling in OpenAI response wrappers to improve event processing and error handling. Introduced conditional imports for response events and error types, ensuring compatibility with missing modules. Updated event processing logic to utilize a consolidated response events tuple.
* Refactor OpenAI response wrappers to enhance error handling and event processing. Introduced context managers for safe instrumentation, improved import handling for response events, and streamlined response attribute extraction logic.
* Add unit tests for ResponseStreamManagerWrapper to validate error handling and stream finalization behavior.
* Remove unnecessary blank line in test_response_wrappers.py to improve code cleanliness.
* Refactor event handling in ResponseStreamWrapper to simplify type checks for response events. Removed unnecessary conditional checks for event types, enhancing code clarity and maintainability.
* Enhance ResponseStreamWrapper and ResponseStreamManagerWrapper with improved error handling and context management. Introduced ExitStack for better resource management and added NotImplementedError for unimplemented parse methods. Updated TODO comments for future refactoring with wrapt.ObjectProxy.
* Add sync streaming support for Anthropic instrumentation
- Add support for Messages.create(stream=True) with StreamWrapper
- Add support for Messages.stream() with MessageStreamManagerWrapper
- Add MessageWrapper for non-streaming response telemetry
- Rename MessageCreateParams to MessageRequestParams
- Add comprehensive tests for sync streaming functionality
* Add changelog entry for sync streaming support
* Fix type checking errors with type: ignore comments
- Add type: ignore[arg-type] for Union type narrowing in messages_create
- Add type: ignore[return-value] for wrapper return types
- Add type: ignore[return-value] for __exit__ returning None
* Refactor Anthropic instrumentation to improve usage tracking and error handling
- Introduce constants for provider name and cache token attributes.
- Normalize stop reasons and aggregate cache token fields in MessageWrapper and StreamWrapper.
- Enhance tests to validate input token aggregation and stop reason normalization.
- Update cassettes for new request and response structures in streaming scenarios.
* Refactor utility functions and test cases for improved readability and consistency
- Simplify constant definitions and normalize function calls in utils.py.
- Enhance test cases by removing unnecessary line breaks and improving formatting.
- Ensure consistent usage of type hints and comments in test functions.
* Refactor argument handling in assert_span_attributes function
- Update the pylint directive to disable too-many-arguments warning for better clarity.
- Maintain consistency in function signature and improve code readability.
* Enhance tests for streaming message handling in Anthropic instrumentation
- Update test cases to validate streaming behavior with various parameters, including token usage and stop reasons.
- Introduce new cassettes for different scenarios, ensuring comprehensive coverage of streaming interactions.
- Refactor existing tests for clarity and consistency in structure and assertions.
* Update test_sync_messages.py to disable pylint warning for too-many-locals in test_stream_wrapper_finalize_idempotent function
* Enhance StreamWrapper and MessageStreamManagerWrapper for idempotent finalization
- Refactor finalization logic in StreamWrapper and MessageStreamManagerWrapper to ensure idempotent behavior during context exit.
- Introduce new methods for successful and error finalization, improving clarity and reducing code duplication.
- Add tests to validate double exit idempotency in streaming scenarios, ensuring only one span is emitted.
- Update cassettes to reflect new request and response structures for streaming interactions.
* Enhance Anthropic instrumentation to support content capture
- Added logger_provider to TelemetryHandler for improved logging capabilities.
- Implemented content capture logic in messages_create and messages_stream functions, allowing for the extraction of input messages and system instructions.
- Introduced utility functions for content conversion and message handling in utils.py.
- Updated tests to validate content capture functionality for both synchronous and streaming message creation.
- Added new cassettes to reflect the changes in request and response structures for content capture scenarios.
* Enhance tests for sync message creation in Anthropic instrumentation
- Added checks for the presence of 'tools' and 'thinking' parameters in the installed anthropic SDK.
- Updated test cases to skip if the SDK version does not support these parameters, ensuring compatibility with older versions.
- Improved test robustness by dynamically determining parameter support.
* Remove sensitive 'anthropic-organization-id' headers from test cassettes and update header scrubbing logic in tests. This enhances security by ensuring sensitive information is not recorded in test artifacts.
* Refactor tests for sync message handling in Anthropic instrumentation
- Simplified detection of 'tools' and 'thinking' parameters by directly accessing the _Messages class.
- Improved readability of test cases by formatting input message loading.
- Enhanced test function signatures for better clarity and maintainability.
* Refactor utils.py for improved type safety and clarity
- Added type casting for dictionary access to enhance type safety.
- Simplified content block conversion logic to improve readability and maintainability.
- Updated test cases to ensure consistent handling of content types and structures.
* Enhance Anthropic instrumentation tests for EVENT_ONLY content capture
- Introduced a new fixture to instrument Anthropic with EVENT_ONLY content capture mode.
- Added tests to verify that content is not captured in span attributes while ensuring log events are emitted correctly.
- Updated cassettes to reflect new request and response structures for EVENT_ONLY scenarios.
- Enhanced existing tests to cover various content capture scenarios, including streaming and tool usage.
* Refactor assertion in sync messages test for clarity
- Simplified the assertion statement in the test_sync_messages_create_event_only_no_content_in_span function to improve readability.
* Refactor content capture logic and enhance streaming tests for Anthropic instrumentation.
* unsetting the model.
* Remove instrumentation for Messages.stream() and refactor related code. Introduced MessageWrapper and StreamWrapper classes for telemetry handling. Updated tests to reflect changes in instrumentation behavior.
* Refactor Anthropic instrumentation: reorganize imports, enhance utility functions, and update wrapper classes for better clarity and maintainability. Removed unused code and improved type safety in utility functions. Updated tests to reflect changes in the instrumentation behavior.
* Add message extractors for Anthropic instrumentation.
* Refactor message extractors in Anthropic instrumentation: reorganize imports and streamline finish reason normalization for improved clarity and maintainability.
* Update test cassettes for Anthropic instrumentation: streamline request and response structures, enhance error handling scenarios, and ensure consistency in message formats across various test cases. Removed outdated data and improved clarity in test interactions.
* Enhance Anthropic instrumentation: update MessageWrapper and StreamWrapper to include content capture logic, improve type safety with explicit casting, and streamline test cases for better clarity. Added new test for streaming response attributes and refined existing tests to ensure consistency in message handling.
* Update test cassettes for Anthropic instrumentation: modify message IDs, timestamps, and token usage across various test cases. Refine content capture logic and ensure consistency in message formats, including adjustments to event data and headers for improved clarity and accuracy.
* Rename StreamWrapper to MessagesStreamWrapper and update references in code and tests
* Refactor type annotations in message extractors and wrappers for improved type safety. Replace 'Any' with 'object' in several function signatures and class attributes. Introduce logging for error handling in MessagesStreamWrapper to enhance instrumentation reliability.
* Enhance type annotations in message extractors and patch for improved clarity and safety. Update function signatures to use specific types instead of 'object', including changes to parameters in extract_params, get_input_messages, and get_system_instruction. Refactor messages_create to ensure correct type handling for streaming and non-streaming responses. Additionally, streamline message handling in MessagesStreamWrapper for better performance and reliability.
* Enhance type safety and error handling in message processing. Update function signatures in `messages_extractors.py` and `wrappers.py` to include specific types, improving clarity and reliability. Introduce handling for `None` values in `get_input_messages` and `get_system_instruction`. Refactor `MessagesStreamWrapper` to better manage usage updates and ensure correct type handling for streaming responses. Add new test cases for aggregating cache tokens and handling streaming errors.
* Refactor assertions in test_sync_messages.py for improved readability. Simplify assertion statements by removing unnecessary parentheses, enhancing code clarity in cache token tests.
* enforce strong typing system.
* Update anthropic dependency version to 0.51.0 in pyproject.toml and requirements.oldest.txt for compatibility improvements.
* Refactor usage token extraction to utilize a new UsageTokens dataclass for improved clarity and type safety. Update extract_usage_tokens function to return UsageTokens instead of a tuple, and adjust related invocations in MessageWrapper and MessagesStreamWrapper accordingly.
* Update anthropic dependency version in uv.lock to 0.51.0 for compatibility improvements.
* Add tests for should_capture_content function in test_events_options.py.
* Enhance Anthropic instrumentation by adding logging support and refining type hints in messages_create function. Update test cassettes for improved accuracy and consistency in response data.
* Refactor content capturing utility function to clarify its purpose in experimental mode. Update related tests to reflect the new function name and ensure accurate assertions for content capturing behavior.
* Refactor import statements in patch.py for improved readability and organization.
---------
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
* Remove unneded packages from docker tests
* Bump some dependencies to avoid warning on deprecated crypto algos
* Remove instrumentations that are not tested in docker-tests
* fix(ci): eliminate SHA propagation flakiness in Core Contrib Test
Each Core Contrib Test job was doing two separate git operations for
the core repo: actions/checkout (uses GitHub internal API, always
works) and then tox installing packages via git+https:// (hits public
CDN, fails when SHA hasn't propagated yet).
Fix by setting per-package env vars (CORE_REPO_API, CORE_REPO_SDK,
CORE_REPO_SEMCONV, CORE_REPO_TEST_UTILS) in the CI workflow to point
at the already-checked-out local copy, eliminating the second network
clone entirely.
Backward compatible: when the new vars are unset (local dev), they
fall back to the existing git URL + subdirectory behavior.
Fixes#4304
Assisted-by: Claude Sonnet 4.6
* fix: restore version header dropped during rebase
Assisted-by: Claude Sonnet 4.6
* move CORE_REPO_* vars to top-level env block
Use github.workspace context instead of a shell step to set the
per-package local path env vars, as suggested in code review.
Assisted-by: Claude Sonnet 4.6
* Add a basic http OpAMP client
* Add some docs and hook it into the system
Still not building content
* Add default value of 30 seconds to heartbeat message interval
* Fix docs build
* More docs improvements
* Fix spellcheck
* Remove local workaround
* Generate workflows and add to release script
* Fix typos in opamp lint commands
* Fix requirements for pylint
* Update opamp/opentelemetry-opamp-client/pyproject.toml
* Recreate requirements
* Add missing opentelemetry-api dependency
* Fix tox test commands
Drop opentelemetry api fixed version from requirements
* Fix tox
* Add baseline of vcrpy 7.0.0
* Ignore pb2 module in pylintrc
* Bump pylint to match the version in core
* Silence pylint warnings
* Don't trace opamp client own http requests
* Permit to pass a custom transport to client
And a custom session to RequestsTransport
* Don't bump pylint after all
* Fix pylint
* Try to typecheck opamp client
* Bump version after rebase
* Fix typecheck in client
* Please pyright in strict mode
* No need for functions and methods to be private since _opamp module is already private
* Add missing protobuf package installation for typecheck
* Fix docs generation
* Fix pyright exclusion rule for proto
Missed .pyi exclusion
* Feedback
* Don't flush the queue at exit
* Log transport send exceptions
* Update example to not assume that the config is in json format
* Fix typo in exception
* Looks like it's implementers
* Add timeout to stop to forward to threads join
* Clarify doc
* Fix typo in var name
* Add support for mTLS
* Add helpers for handling of ReportFullState ServerToAgent flag
Introducing basic handling of the ReportsEffectiveConfig capability
* Remove backup file
* Rewrite opamp_proto_codegen.sh to use uv
* Make the package releasable independently
* Send full state at connection
* Add 3.14 test run
* Add changelog entry
* Add missing ReportsEffectiveConfig capability in documentation
* Start version from 0.1b0 and re-record e2e tests
* Record tests against opentelemetry-go
---------
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
* Support latest experimental conventions in openai
* format
* changelog
* lint
* lint
* update to use new test utils, fix tests
* lint
* review
* address feedback
* review
* feedback: more readable
* Move logging integrations into auto-instrumentation
* opentelemetry-instrumentation-logging: move the sdk logging handler here
And hook it up via entry point
* Add header and future annotations import
* Rename entry point group to opentelemetry_logging_integrations
* Consider setting up the LoggingHandler as a normal instrumentation
* Fix typo
* Add missing import
* Copy handler tests from core
* More work towards green tests
* Cleanup properly after loggingHandler tests
* Quite hard to expect a mock to setup the handler
* Call removehandler also on local loggers
No change in practice
* Fix wrong noop test
* Move to our own env var for controlling autoinstrumentation
* Copy handler benchmark from sdk
* Document the new environment variables
* Add changelog
* Please pylint
* Added warning about coexistence with sdk code
* Reword a bit
* Assert that the LoggingHandler has not been setup in uninstrumented test
* Add manual handling of auto instrumentation and code attributes logging
* Update instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py
* Apply suggestions from code review
Co-authored-by: Pablo Collins <pablo.collins@gmail.com>
* Apply more Pablo feedback
---------
Co-authored-by: Pablo Collins <pablo.collins@gmail.com>
* asyncio: fix environment variables not in docs
Fix the docstrings in environment_variables.py so they are correctly
picked up by Sphinx autodoc for Read the Docs.
Previously the docstrings were placed above the variable assignments,
which Sphinx cannot parse. Moved them below and added the
required '.. envvar::' directives, consistent with how other
packages (e.g. opentelemetry-instrumentation) document their
environment variables.
Fixes#4256
* Fix typo from 'determines' to 'determine'
* Apply suggestion from @xrmx
* asyncio: move environment_variables docs to __init__ module docstring for sphinx
* asyncio: keep envvar docs in environment_variables.py with module-level docstring
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
The openai-v2 examples predate (2024) the Jan 2025 decouple
(f3b9e6ec96b7cc3717d5c8b529da7a8923810973 in core) of the log machinery setup from
the LoggingHandler setup. So unless I'm missing something and you
really want to see OpenTelemetry logs shipped from Python logging module
usage in these genai examples I think we can drop these.
We're moving the logging handler from the sdk to the opentelemetry-instrumentation-logging and
deprecating that environment variable.
* gen-requirements: stay with virtualenv < 21
No idea what's going on but looks like hatch / hatchling has issues with
latest virtualenv 21:
Environment `hatch-build` is incompatible: module 'virtualenv.discovery.builtin' has no attribute 'propose_interpreters'
* Update gen-requirements.txt
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
---------
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
* Add initial implementation of Anthropic Agents instrumentation
- Introduced `opentelemetry-instrumentation-anthropic-agents` package for tracing LLM requests using the Anthropic Python SDK.
- Added support for capturing request and response attributes in accordance with GenAI semantic conventions.
- Included examples for both manual and zero-code instrumentation.
- Created a CHANGELOG.md to document notable changes.
- Added LICENSE and README files for package details and usage instructions.
This commit lays the groundwork for enhanced observability in applications utilizing Anthropic's capabilities.
* Enhance instrumentation for Anthropic Agents
- Added support for the `opentelemetry-instrumentation-anthropic-agents` package, enabling tracing of requests made through the Claude Agent SDK.
- Updated `pyproject.toml` and `tox.ini` to include new test environments and dependencies for the Anthropic Agents instrumentation.
- Modified GitHub workflows to incorporate linting and testing for the new instrumentation.
- Improved documentation in README files and examples to reflect changes in usage and setup.
- Introduced new examples demonstrating both manual and zero-code instrumentation approaches.
This commit strengthens observability for applications utilizing Claude Agents, ensuring comprehensive tracing and logging capabilities.
* Remove outdated entries from CHANGELOG.md for Anthropic Agents instrumentation, streamlining the document to reflect current features and improvements.
* Update Anthropic Agents instrumentation to use Claude Agent SDK
- Changed dependency from `anthropic >= 0.16.0` to `claude-agent-sdk >= 0.1.14` in `README.md`, `pyproject.toml`, and related files.
- Refactored `AnthropicAgentsInstrumentor` to align with the new SDK, including updates to initialization and logging.
- Removed unused utility functions and cleaned up test configurations to reflect the new dependency.
- Updated tests to ensure compatibility with the Claude Agent SDK.
This commit enhances the instrumentation for applications using the Claude Agent SDK, ensuring accurate tracing and logging capabilities.
* Update Python version requirements and clean up workflows for Anthropic Agents instrumentation
- Updated `tox.ini` and `pyproject.toml` to require Python 3.10 or higher, removing support for Python 3.9.
- Cleaned up GitHub workflows by removing outdated test jobs for Python 3.9 and adding new jobs for Python 3.10.
- Updated `README.md` to reflect the new dependency on `claude-agent-sdk` and removed references to the old SDK.
- Made minor code cleanups in example scripts and test files to improve readability.
These changes ensure compatibility with the latest Python versions and streamline the testing process for the Anthropic Agents instrumentation.
* Add Anirudha as a component owner for Anthropic instrumentation.
* fixing precommit errors.
* Update version comment in `version.py` to indicate future stable release
* Refactor imports in `__init__.py` for Anthropic Agents instrumentation.
* regenerate uv.lock file.
* Update uv.lock to standardize package source URLs with trailing slashes
* Rename instrumentation for Anthropic Agents to Claude Agent SDK, updating references in configuration files, workflows, and documentation. Add new files for the Claude Agent SDK instrumentation, including README, examples, and changelog. Ensure proper setup for testing and linting in CI/CD workflows.
* Update release documentation and workflows to include new instrumentation for Anthropic and Claude Agent SDK.
* Add Mike Goldsmith as a component owner for Anthropic and Claude Agent SDK instrumentation
* Revert "Merge remote-tracking branch 'upstream/main' into feat/anthropic-agents-boilerplate"
This reverts commit 7ed01ecb2d, reversing
changes made to 7e83cd7d74.
* Reapply "Merge remote-tracking branch 'upstream/main' into feat/anthropic-agents-boilerplate"
This reverts commit 7714e3c544.
* Update Python version in workflows and adjust dependencies in uv.lock.
* Fix source URLs in uv.lock to ensure proper registry formatting.
* add gen_ai.tool_definitions to completion hook
* hash tool defintions
* Update CHANGELOG
* make tool.defintions optional in on_completion
* fix lint errors
* add gen_ai.tool_definitions to completion hook
* hash tool defintions
* fix CompetionHook docstring
* fix lint test
* add gen_ai.tool_definitions to completion hook
* hash tool defintions
* Update CHANGELOG
* align tool.defintions with JSON schema
* fix tests
* fix ruff
* fix unexpected indent
* use local changes from util/opentelemetry-util-genai
* fix ruff
* add gen_ai.tool_definitions to completion hook
* re-add changes lost during merge
* put tool.defintions in the telemetry by default and the params behind the flag
* fix: Too many local variables
* address comments
* Add comments to udpate of util-genai version after release
---------
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
* update invocation span to have kind SERVER and have name equal to the function name
* update Lambda invocation span name and kind
* add type checking check
* move changelog entry to 'Breaking changes'
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* cassandra: use _instruments_any instead of _instruments for driver deps
The cassandra instrumentation listed both cassandra-driver and
scylla-driver in _instruments, which requires ALL listed packages to be
installed. Since users install one OR the other (they are alternative
drivers for the same API), this should use _instruments_any so that
having either driver installed is sufficient.
This follows the same pattern already used by psycopg2 and kafka-python
instrumentations, introduced in #3610.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix ci
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* fix uv.lock
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
---------
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: emdneto <9735060+emdneto@users.noreply.github.com>
* fix instrument of typed psycopg sql
The instrumentation is not working when using [typed `SQL`](https://www.psycopg.org/psycopg3/docs/api/sql.html) from psycopg (only when using the `Composed` type, that is returned when the query is formated).
```python
from psycopg.sql import SQL
query = SQL("SELECT * FROM test")
```
This fixes it by checking the `Composable` base class instead of the more restricted `Composed`.
* add changelog
* fix tests for python 3.9
using an identifier requires a real connection, I just replaced it since we only want to test with a composed.
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
StreamWrapper did not proxy unknown attributes like .headers to the
underlying stream, causing AttributeError when using
with_raw_response.create(stream=True).
Add __getattr__ to delegate attribute lookups to self.stream.
Fixes#4113
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>