2470 Commits

Author SHA1 Message Date
c6cdbeb51f Add missing dependency to click / asyncclick instrumentations (#3447)
Using click / asyncclick instrumentation in a project that does not
already depend on opentelemetry-instrumentation raises a module
not found error.

Added opentelemetry-instrumentation as a dependency for click &
asyncclick.
2025-04-28 12:14:34 +02:00
7f347e54df infra: Automate SHA procedure during releases (#3424) 2025-04-24 09:31:08 -08:00
369a9f2e00 Include more request configuration options into the span attributes for the Google GenAI SDK instrumentation (#3374)
* Create a utility to simplify recording request attributes.

* Update recording mechanism to record more request options.

* Improve the recording of span request attributes.

* Reformat with ruff.

* Update TODOs to reflect change made here.

* Update changelog now that PR has been created and can be referenced.

* Fix lint issues.

* Reformat with ruff.

* Add more documentation comments requested in the pull request.

* Add tests and comments that provide some additional clarity regarding the flattening logic in response to PR comments.

* Add tests and comments that provide some additional clarity regarding the flattening logic in response to PR comments.

* Handle corner case where flatten function returns compound output.

* Update prefix to match currently proposed SemConv.

* Update to specify attributes from SemConv constants per PR feedback.

* Use an allowlist for dynamic keys per PR feedback.

* Reformat with ruff.

* Fix lint issues.

* Reformat with ruff.

* Handle flattening errors more gracefully.

* Add support for more wildcards in the allowlist.

* Add a clearer type for the flatten functions.

* Simplify 'exclude_keys' initialization per PR feedback.

* Simplify AllowList constructor type annotation per PR feedback.

* Reformat with ruff.

* Resolve lint error concerning too many returns.

* Reformat with ruff.

* Update name to reflect requested changes in Semantic Conventions pull request #2125.

* Add test to verify correct handling of Unicode.

* Reformat with ruff.

* Remove deuplicated test.
2025-04-23 13:08:22 -04:00
c54292fa08 Check for None result in gRPC (#3380) (#3381) 2025-04-21 07:41:14 -08:00
d6f6c60c16 autoinstrumentation: don't print duplicated conflict log error message (#3432)
* Update instrumentor.py

* Add tests for dependency conflict logging

* Format code in test_instrument_missing_dependency

* Add comments for dependency conflict handling
2025-04-18 16:53:35 +00:00
dd151673d1 support InvokeModel GenAi instrumentation for additional Bedrock models (#3419)
This adds basic request and response gen_ai instrumentation for the following Bedrock model providers:
Cohere Command and Command R, Meta Llama, Mistral AI
2025-04-18 11:25:30 +02:00
3431a4e8b0 Update core_contrib_test_0.yml (#3431)
* Update core_contrib_test_0.yml

* Update core_contrib_test.yml.j2
2025-04-17 14:04:38 -04:00
c47e341ab8 Update CHANGELOG.md (#3430) 2025-04-17 15:36:45 +02:00
8390db35ae infra(ci): configure concurrency to cancel stale runs and setting timeouts (#3422)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-17 08:07:46 +00:00
b8018c5262 Ensure that the Google GenAI SDK instrumentation correctly populates "finish_reasons" on the span. (#3417)
* Fix bug where 'gen_ai.response.finish_reasons' was not being correctly populated.

* Update changelog.

* Reformat with ruff.
2025-04-15 16:06:59 -04:00
ce90639428 Removed the unnesessary packages from tornado requirements file (#3411)
Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>
2025-04-15 20:11:17 +02:00
fce17db166 asyncio: fix duplicate instrumentation (#3408)
* #3383 fix duplicate instrument

* #3383 fix duplicate instrument

* feedback

* feat(asyncio): add weakref-based tracking for instrumented objects

* Use WeakKeyDictionary to safely track instrumented objects

* feedback

* feedback

* feedback

---------

Co-authored-by: allen <allen.k1m@kakaocorp.com>
2025-04-15 15:59:04 +00:00
9c969f363e autoinstrumentation: catch ModuleNotFoundError when the library is not installed (#3423)
* catch ModuleNotFoundError when the library is not installed and prevent exception from bubbling up

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

* cleanup

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

* remove dup test

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

* Update CHANGELOG.md

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-04-15 09:43:13 +02:00
7562ff08f3 Improve tornado instrumentation example (#3410)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-14 14:56:53 +00:00
4b832859cc test-requirements: Bump jinja2 to 3.1.6 (#3420)
To please dependabot
2025-04-11 18:01:16 +02:00
6587485d05 Update version to 1.33.0.dev/0.54b0.dev (#3413)
* Update version to 1.33.0.dev/0.54b0.dev

* Point CORE_REPO_SHA to opentelemetrybot/update-version-to-1.33.0.dev-0.54b0.dev

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-10 13:53:58 +00:00
bb85f983a3 Fix aiokafka multiple values headers error. (#3332)
* Fix aiokafka multiple values headers

* modify testcase

* add changelog

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-10 10:22:01 +00:00
04f9e8dd7f Improve starlette instrumentation example (#3409) 2025-04-10 11:57:07 +02:00
6d5a5149d0 Make auto instrumentation use the same dependency resolver as manual instrumentation does (#3202) 2025-04-08 15:11:09 +02:00
6bde73ce34 Improve pika instrumentation examples (#3390) 2025-04-02 14:17:52 +00:00
3a585b4b58 Improve httpx instrumentation examples (#3387) 2025-04-02 10:40:39 +00:00
e50cb3271f Improve kafka-python instrumentation examples (#3388)
* Improve kafka-python instrumentation example

* Improve kafka-python instrumentation examples
2025-04-02 10:29:21 +00:00
5a2cfb3d65 Improve sqlalchemy instrumentation example (#3396) 2025-04-02 10:17:32 +00:00
fdcd80d89f Improve remoulade instrumentation example (#3391) 2025-04-02 09:58:35 +00:00
ff18e7c18b Build instrumentation-genai/README.md (#3400)
* scripts: build a README also for instrumentation-genai

* opentelemetry-instrumentation-openai-v2: add supports_metrics to package

* opentelemetry-instrumentation-google-genai: add missing package.py

* Build instrumentation-genai/README.md
2025-04-02 09:45:56 +00:00
78373353f5 Add ossf-scorecard scanning workflow (#3398)
* Add ossf-scorecard scanning workflow

* Add end of file newline

---------

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-02 09:28:12 +00:00
fa499f5ca8 fix: grpc server ValueError when using unix sockets (#3394)
* fix: grpc server ValueError when using unix sockets

with some grpc implementations the full .peer address is available
for unix sockets, which includes the socket path. it seems that
in versions of grpc prior to 1.53.0, the full path is returned by
`context.peer()`. rather than change the dependency of the instrumentation,
this updates it to more gracefully handle the case of the socket path
being present or absent.

Fixes #3393

* add changelog entry

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-02 08:42:29 +00:00
642d8c4081 botocore: add some more content to the README (#3395)
* botocore: add some more content to the README

This is taken from __init__.py documentation.

* Move the content to the README since it's not really code specific

* Add link to examples

* Apply suggestions from code review

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

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-04-01 12:44:09 +00:00
27d5d93a6a Improve asyncpg instrumentation example (#3349)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-31 12:58:39 +00:00
3d37106115 botocore: handle tool calls with Amazon nova with Bedrock InvokeModel* APIs (#3385)
* botocore: test invokemodel tool calls against amazon nova

* botocore: handle amazon nova tool calls events for InvokeModelWithResponseStream

* Update documentation

* Update Changelog

* Please pylint

* Cleanup

* Reduce branches in tool calls tests

Instead pass down a per-model object that implements the peculiar part.

And fix recording of amazon.nova stream no content test.

* Move stream content extraction for tool calls tests to a couple of helpers
2025-03-31 08:53:15 +00:00
dde065b139 use type instead of pyright (#3392)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-03-28 20:15:42 +00:00
8b2558f22e VertexAI support for async calling (#3386)
* VertexAI support for async calling

* Clarify things a bit

* Fix python 3.8 and 3.9 tests

* Remove unnecessary record check

* Update instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/__init__.py

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

* ruff

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-03-28 17:44:28 +00:00
0ea9998c4c Add asyncclick instrumentation (#3319)
* Add asyncclick instrumentation

* Add instrumentation for asyncclick based CLI apps
* Add tox
* Add Changelog
* Update workflows

This implementation is based on the original click instrumentation work by:
- Emídio Neto <9735060+emdneto@users.noreply.github.com>
- Anuraag (Rag) Agrawal <anuraaga@gmail.com>
- Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>

* Update CHANGELOG.md

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

* Fix async refs in code-block example

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-03-28 12:20:29 +01:00
50ab047143 bug_fix(1477): type handling in _add_sql_comment (#3113)
---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-03-27 14:43:30 +01:00
139d787168 fix: opentelemetry-instrumentation-openai-v2 version in example (#3350) 2025-03-26 08:22:12 +00:00
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