2435 Commits

Author SHA1 Message Date
af179659a2 Fix client address is set to server address in new semconv (#3354)
* Fix client address is set to server address

* fix: asgi tests

* docs: update CHANGELOG

* docs: update CHANGELOG

* refactor: only populate server address if missing

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2025-03-24 16:15:51 +01:00
76e614fac4 Improve botocore instrumentation examples (#3348) 2025-03-21 17:05:56 +00:00
46cf5b5257 Add instrumentation example to logging (#3314)
* Add instrumentation example to logging

* Add example output to logging instrumentation example

* Fix logging instrumentation example and output

* Fixing rst syntax for logging instrumentation examples

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-21 17:33:51 +01:00
164259e149 Improve elasticsearch instrumentation examples (#3367)
* Improve elasticsearch instrumentation examples

* Fix doc_type for elasticsearch instrumentation examples
2025-03-21 15:15:31 +00:00
db617eb3fd Improve confluent-kafka instrumentation examples (#3369)
* Improve confluent-kafka instrumentation example

* Improve confluent-kafka tracer provider example

* Apply suggestions from code review

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-21 14:25:38 +00:00
3c60b62ad1 Improve falcon instrumentation examples (#3370) 2025-03-21 13:53:54 +00:00
8d14f0bb2a Improve flask instrumentation example (#3371) 2025-03-21 13:37:30 +00:00
a5474c3b29 Improve fastapi instrumentation example (#3372) 2025-03-20 16:02:36 +00:00
e43e8c91cd [chore] Address TODO to migrate to VCRpy and remove bespoke RequestMocker code in Google GenAI SDK instrumentation (#3344)
* Remove bespoke request mocker. Replace with direct mocking of the underlying API.

* Refactor fake credentials to enable reuse.

* Add module to test end to end with a real client.

* Add redaction and minimal OTel mocking/testing in the e2e test.

* Fix wording of the documentation.

* Remove vcr migration from TODOs.

* Improve redaction and test naming.

* Minor tweaks in the code generation. Add casette files.

* Reformat with ruff.

* Fix lint and gzip issue.

* Reformat with ruff.

* Prevent fix for Python 3.9 from breaking tests in other versions.

* Record update in changelog.

* Don't double iterate when redacting by changing the value.

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-03-19 13:58:15 -04:00
ad29af3996 opentelemetry-instrumentation: fix RST syntax of README (#3362)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-03-13 19:34:49 +01:00
3c88163c99 Handle empty strings in sqlcommenter (#3309)
* Handle empty strings

Safer check for a trailing semicolon that could handle
empty strings as well.

* Updated CHANGELOG.md

* Test for empty SQL strings in sqlcommenter

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-13 11:18:35 +00:00
f96d14cc62 update (#3363) 2025-03-13 09:35:08 +01:00
6189be647c Update version to 1.32.0.dev/0.53b0.dev (#3359) 2025-03-12 12:07:49 -08:00
6daf581f46 Improve urllib3 instrumentation examples (#3347)
* Improve urllib3 instrumentation example

* Port urllib3 instrumentation example improvements to README.rst

* Add trailing commas to urllib3 instrumentation examples

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-12 14:08:50 +00:00
db52193b3c bump pyright (#3355)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-03-11 21:11:54 +00:00
3708604bb5 botocore: sns set destination name attribute to arn and redact phone number (#3249)
* set destination name only if not phone number

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* redact phone_number

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* add changelog

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-10 09:39:12 +00:00
d5dce5de99 Improve asyncio instrumentation examples (#3312)
* Improve asyncio instrumentation examples

* Port asyncio instrumentation example changes to README.rst

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-07 16:27:35 +00:00
ad2fe813ab Fix threading instrumentation context types (#3322)
Add None check to context handling in threading instrumentation
Add testcases for None context

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-06 12:44:44 -05:00
fde1ef84c7 Add instrumentation example to aiohttp-server (#3311) 2025-03-06 08:41:58 -08:00
9811782358 Implement uninstrument for opentelemetry-instrumentation-vertexai (#3328)
* Implement uninstrument for `opentelemetry-insturmentation-vertexai`

* Reuse fixture from conftest.py
2025-03-06 15:43:49 +00:00
4f9ee01b5f Improve django instrumentation example (#3313)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2025-03-06 14:18:14 +00:00
2d5a21a3da instrumentation: rename experimental semconv status to development in README (#3333)
* instrumentation: rename experimental to development in README

To match the current semantic conventions naming.

* Update generate_instrumentation_readme.py

* Update README.md

* Run generate

* Update the README too
2025-03-06 13:30:28 +00:00
3dd42960e0 Change affiliation for emdneto (#3343) 2025-03-06 13:05:15 +00:00
c0132c6ab0 urllib: don't assume we control the bucket metrics data point get in (#3341)
Instead of expecting an entry in a specific bucket, just sum all of them
and assert we have the correct number of entries.

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2025-03-06 12:10:51 +00:00
65720812f7 build(deps): bump jinja2 from 3.1.4 to 3.1.6 (#3340)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.4 to 3.1.6.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.4...3.1.6)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-06 11:20:54 +00:00
fa8a6995c7 botocore: don't crash when sending content as string with InvokeModel (#3342)
As apparently langchain does with Claude.
2025-03-06 09:50:10 +00:00
23cadea66a requests: always record span status code in duration metrics (#3323)
* show test fail at main

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* implement fix -- ci should pass now

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* remove uneeded comment

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* Update instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py

* use get_sorted_metrics

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2025-03-06 08:56:41 +00:00
2371adf3f8 Improve requests instrumentation example (#3316) 2025-03-05 23:23:09 -08:00
a83c8d9a04 make urllib test less flaky (#3336)
* make urllib test less flaky

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* Update instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py

* ruff

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-03-05 21:39:37 +00:00
a01564cf08 Update opentelemetry-instrumentation-google-genai version to v0.2b0 (#3334) 2025-03-05 14:28:54 -05:00
9e4de00420 Small fixes for google-genai before releasing (#3330) 2025-03-05 10:40:00 -05:00
0ff1032bdd botocore: add genai metrics for bedrock extensions (#3326)
This add genai metrics regarding the operation duration and the tokens used to botocore bedrock extension.
2025-03-05 09:14:39 +00:00
81eaea57f9 Add support for async and streaming responses in the Google GenAI instrumentation (#3298)
* Begin instrumentation of GenAI SDK.

* Snapshot current state.

* Created minimal tests and got first test to pass.

* Added test for span attributes.

* Ensure that token counts work.

* Add more tests.

* Make it easy to turn off instrumentation for streaming and async to allow for rapid iteration.

* Add licenses and fill out main README.rst.

* Add a changelog file.

* Fill out 'requirements.txt' and 'README.rst' for the manual instrumentation example.

* Add missing exporter dependency for the manual instrumentation example.

* Fill out rest of the zero-code example.

* Add minimal tests for async, streaming cases.

* Update sync test to use indirection on top of 'client.models.generate_content' to simplify test reuse.

* Fix ruff check issues.

* Add subproject to top-level project build mechanism.

* Simplify invocation of pylint.

* Fix 'make test' command and lint issues.

* Add '.dev' suffix to version per feedback on pull request #3256

* Fix README.rst files for the examples.

* Add specific versions for the examples.

* Revamp 'make test' to not require local 'tox.ini' configuration.

* Extend separators per review comment.

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>

* Fix version conflict caused by non-hermetic requirements.

* Fix typo on the comment line.

* Add test for the use of the 'vertex_ai' system, and improve how this system is determined.

* Factor out testing logic to enable sharing with the async code.

* Addressed minor lint issues.

* Make it clearer that nonstreaming_base is a helper module that is not invoked directly.

* Integrate feedback from related pull request #3268.

* Update workflows with 'tox -e generate-workflows'.

* Improve data model and add some rudimentary type checking.

* Accept only 'true' for a true value to align with other code.

* Update the scope name used.

* Add **kwargs to patched methods to prevent future breakage due to the addition of future keyword arguments.

* Remove redundant list conversion in call to "sorted".

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

* Reformat with 'tox -e ruff'.

* Fix failing lint workflow.

* Fix failing lint workflow.

* Exclude Google GenAI instrumentation from the bootstrap code for now.

* Minor improvements to the tooling shell files.

* Fix typo flagged by codespell spellchecker.

* Increase alignment with broader repo practices.

* Add more TODOs and documentation to clarify the intended work scope.

* Remove unneeded accessor from OTelWrapper.

* Add more comments to the tests.

* Reformat with ruff.

* Change 'desireable' to 'desirable' per codespell spellchecker.

* Make tests pass without pythonpath

* Fix new lint errors showing up after change

* Revert "Fix new lint errors showing up after change"

This reverts commit 567adc62a706035ad8ac5e29316c7a6f8d4c7909.

pylint ignore instead

* Add TODO item required/requested from code review.

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

* Simplify changelog per PR feedback.

* Remove square brackets from model name in span name per PR feedback.

* Checkpoint current state.

* Misc test cleanup. Now that scripts are invoked solely through pytest via tox, remove main functions and hash bang lines.

* Improve quality of event logging.

* Implement streaming support in RequestsMocker, get tests passing again.

* Add test with multiple responses.

* Remove support for async and streaming from TODOs, since this is now addressed.

* Increase testing coverage for streaming.

* Reformat with ruff.

* Add minor version bump with changelog.

* Change TODOs to bulleted list.

* Update per PR feedback

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

* Restructure streaming async logic to begin execution earlier.

* Reformat with ruff.

* Disable pylint check for catching broad exception. Should be allowed given exception is re-raised.

* Simplify async streaming solution per PR comment.

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-03-03 22:39:31 +00:00
c6c0162cef Loosen opentelemetry-instrumentation-starlette[instruments] specifier (#3304)
* Loosen `opentelemetry-instrumentation-starlette[instruments]` specifier

* Compile locked requirements with uv

* Update comment for clarity

* Generate for python 3.8+

* Update package.py as well

* generate

* Oops, undo accidental change to starlette version

* Update uv pip compile command to remove core repo git SHAs and absolute paths
2025-03-03 20:22:57 +00:00
f98f5688ae Improve pymongo instrumentation example (#3315) 2025-03-03 10:17:02 +01:00
6114b60506 Copy changelog updates from package-release/opentelemetry-instrumentation-vertexai/v2.0bx (#3295)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-28 15:28:39 +00:00
f17a1bd65a Add opentelemetry-instrumentation-vertexai>=2.0b0 to opentelemetry-bootstrap (#3307)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-28 14:23:38 +00:00
e0189e25dc Improves aiohttp_client code snippet (#3306)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-28 14:10:25 +00:00
2f4d4c56fc botocore: send tool events for bedrock (#3302)
* botocore: send tool events for bedrock

This implements sending tool events for:
- Converse
- ConverseStream
- InvokeModel with anthropic claude 3+ models
- InvokeMoldeWithStreamResponse with anthropic claude 3+ models

* Add changelog

* Please pylint
2025-02-28 08:51:33 +00:00
c09a299010 Initial version of instrumentation for the Google GenAI SDK (github.com/googleapis/python-genai) (#3256)
* Begin instrumentation of GenAI SDK.

* Snapshot current state.

* Created minimal tests and got first test to pass.

* Added test for span attributes.

* Ensure that token counts work.

* Add more tests.

* Make it easy to turn off instrumentation for streaming and async to allow for rapid iteration.

* Add licenses and fill out main README.rst.

* Add a changelog file.

* Fill out 'requirements.txt' and 'README.rst' for the manual instrumentation example.

* Add missing exporter dependency for the manual instrumentation example.

* Fill out rest of the zero-code example.

* Add minimal tests for async, streaming cases.

* Update sync test to use indirection on top of 'client.models.generate_content' to simplify test reuse.

* Fix ruff check issues.

* Add subproject to top-level project build mechanism.

* Simplify invocation of pylint.

* Fix 'make test' command and lint issues.

* Add '.dev' suffix to version per feedback on pull request #3256

* Fix README.rst files for the examples.

* Add specific versions for the examples.

* Revamp 'make test' to not require local 'tox.ini' configuration.

* Extend separators per review comment.

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>

* Fix version conflict caused by non-hermetic requirements.

* Fix typo on the comment line.

* Add test for the use of the 'vertex_ai' system, and improve how this system is determined.

* Factor out testing logic to enable sharing with the async code.

* Addressed minor lint issues.

* Make it clearer that nonstreaming_base is a helper module that is not invoked directly.

* Integrate feedback from related pull request #3268.

* Update workflows with 'tox -e generate-workflows'.

* Improve data model and add some rudimentary type checking.

* Accept only 'true' for a true value to align with other code.

* Update the scope name used.

* Add **kwargs to patched methods to prevent future breakage due to the addition of future keyword arguments.

* Remove redundant list conversion in call to "sorted".

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

* Reformat with 'tox -e ruff'.

* Fix failing lint workflow.

* Fix failing lint workflow.

* Exclude Google GenAI instrumentation from the bootstrap code for now.

* Minor improvements to the tooling shell files.

* Fix typo flagged by codespell spellchecker.

* Increase alignment with broader repo practices.

* Add more TODOs and documentation to clarify the intended work scope.

* Remove unneeded accessor from OTelWrapper.

* Add more comments to the tests.

* Reformat with ruff.

* Change 'desireable' to 'desirable' per codespell spellchecker.

* Make tests pass without pythonpath

* Fix new lint errors showing up after change

* Revert "Fix new lint errors showing up after change"

This reverts commit 567adc62a706035ad8ac5e29316c7a6f8d4c7909.

pylint ignore instead

* Add TODO item required/requested from code review.

Co-authored-by: Aaron Abbott <aaronabbott@google.com>

* Simplify changelog per PR feedback.

* Remove square brackets from model name in span name per PR feedback.

* Misc test cleanup. Now that scripts are invoked solely through pytest via tox, remove main functions and hash bang lines.

* Improve quality of event logging.

* Update operation name to use a constant for consistency.

* Reformat with ruff.

* Exclude opentelemetry-instrumentation-google-genai from root uv workspace

Until https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3300 is fixed.

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-02-27 11:37:40 -05:00
139f3e52d9 Update doc for OpenAI Instrumentation to support OpenAI Compatible Platforms (#3279)
* Update doc for OpenAI Instrumentation to support DeepSeek

* Update with Adrian's comments

Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>

* rollback the blankspace remove

---------

Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2025-02-26 13:03:29 +02:00
b76119bb8f VertexAI fix RST title underline (#3292) 2025-02-24 13:07:27 -05:00
c4eb3714c5 Update opentelemetry-instrumentation-vertexai version to v2.1b0 (#3286)
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-02-24 12:17:07 -05:00
dc01beda66 Add run-name with package name to single-package release workflows (#3287) 2025-02-24 15:48:36 +00:00
38006e86c4 opentelemetry-instrumentation: expose a way to init autoinstrumentation programmatically (#3273)
* opentelemetry-instrumentation: expose a way to init autoinstrumentation

* Please pylint

* Add changelog

* Fix example

* Fix whitespace in README

* Add a note aboout ordering of initialization vs imports

* Don't touch PYTHONPATH if not set

* Update opentelemetry-instrumentation/README.rst

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>

* Update CHANGELOG.md

* Update opentelemetry-instrumentation/README.rst

Co-authored-by: Leighton Chen <lechen@microsoft.com>

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2025-02-24 11:15:13 +00:00
b1f714ee0f botocore: send choice events for bedrock chat completion (#3275)
* botocore: send choice events for bedrock chat completion

* Please pylint

* Add CHANGELOG

* Always call done stream callback

* Move choice event creation to _Choice and add types
2025-02-24 10:34:00 +00:00
3c2599c761 opentelemetry-docker-tests: bump grpcio to 1.63.2 (#3290)
To match the baseline added to opencensus exporter.
2025-02-24 11:16:57 +01:00
f8bb30ef67 Updating workflows and RELEASING.md to allow vertexai individual release (#3284) 2025-02-21 17:12:14 -03:00
72490eafcd Fix uv setup when using tox (#3282)
* Update core_contrib_test_0.yml

* add tox-uv.toml to ignore sources

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* revert workflows change

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* add aws xray propagator to show it works

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

* add genai

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-02-21 16:26:46 +00:00
638c57f7a4 Fix opentelemetry-instrumentation-vertexai version pre 2.0b0 release (#3281)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-21 10:07:12 -05:00