2863 Commits

Author SHA1 Message Date
otelbot[bot]
1102e356e5 Update opentelemetry-instrumentation-google-genai version to v0.6b0 (#4023)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-12-11 15:43:21 +01:00
Ezzio Moreira
4e738a7935 opentelemetry-instrumentation-sqlalchemy: stop using SpanAttributes (#4019)
* feat: stop using spanatribute

* Update instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py

* Update instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-12-11 10:49:36 +01:00
Hector Hernandez
0fca05512d fix(http): handle byte user-agent headers before synthetic detection (#4010)
* fix(http): handle byte user-agent headers before synthetic detection

* Adding changelog

* Address comments
2025-12-11 09:50:20 +01:00
Riccardo Magliocchetti
b95b360409 Add back @hectorhdzg to approvers (#4018) 2025-12-11 09:47:44 +01:00
Riccardo Magliocchetti
f730a63d75 Update notes document url to the new google docs location (#4016) 2025-12-10 11:44:02 +01:00
Teja
3cd9a74f6d Anthrophic instrumentation boilerplate (#3978)
* wip: initial boilerplate for anthrophic sdk instrumentation.

* polish: adding the correct pull request number.

* polish: fixing linting errors and refining the tests.

* polish: removing the oldest ubuntu github actions test as jiter is not available.

* Update instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/version.py

Co-authored-by: Liudmila Molkova <neskazu@gmail.com>

* wip: pr amends.

* Remove anthropic from independent_packages and regenerate bootstrap

---------

Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
2025-12-09 12:05:50 -05:00
DylanRussell
8fa0c1bd0c Add some sem conv attributes to the stable vertex AI and gen AI instrumentations (#4011)
* Add some sem convs to non-experimental instrumentations

* Fix sys instruct bug

* Respond to comments..
2025-12-08 09:20:18 -05:00
Riccardo Magliocchetti
51dde66fb6 Fixup docs rendering in pymssql and pymongo (#4007)
* opentelemetry-instrumentation-pymongo: fix rendering of API docs

While at it make the list of instrumentor parameters readable.

* opentelemetry-instrumentation-pymssql: fix rendering of API docs

* Update __init__.py
2025-12-05 19:22:24 +00:00
Ben Drucker
e1074326a8 botocore: document threading instrumentation for S3 multipart operations (#3999)
* botocore: document threading instrumentation for S3 multipart operations

Document that users need to enable ThreadingInstrumentor alongside
BotocoreInstrumentor for proper trace context propagation with S3
upload_file and download_file methods.

* botocore: move thread context docs to module docstring only

README.rst is not built into the documentation, so keep the
threading context propagation docs only in __init__.py where
autodoc will pick them up.

* Update __init__.py

* Update __init__.py

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-12-05 17:17:29 +01:00
Keith Decker
61641aa383 GenAI Utils | Add metrics to LLMInvocations (#3891)
* add metrics to genai utils

* add Instruments class for GenAI metrics and refactor metric recording

* refactor: streamline metric payload handling in InvocationMetricsRecorder

* fix: grammar

* doc: added changelog

* fix: update version for semconvs

* Lint fixes

* Fix Nits, remove overly defensive code

* Add monotonic timing support for LLM invocation duration calculations

* small cleanups to types to simplify code

* cleanup test

* Simplify histogram duration time calculations

* Remove unused constants and helper function

* Refactor histogram creation to use standalone functions instead of a class

---------

Co-authored-by: aaronabbott <aaronabbott@google.com>
2025-12-03 11:29:37 -05:00
Riccardo Magliocchetti
0870f96c1c Fix 1.39.0 changelog (#3998) 2025-12-03 13:51:59 +00:00
otelbot[bot]
f88fa49e4c Update version to 1.40.0.dev/0.61b0.dev (#3995)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-12-03 14:38:11 +01:00
Steve Liu
be8dfdc4d8 Add safety check for bedrock ConverseStream responses (#3990)
* add defensive check for from_converse response

* add defensive check for from_converse response

* Update instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py

* Update CHANGELOG.md

* add comment for malformed repsonses in from_converse

* merge suggested changes

* fix botocore converse stream test

* lint fix

* Update instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py

* add defensive check just in case content doesn't exist in orig_message

* lint fix

* new line

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-12-03 09:42:05 +01:00
Philip Meier
77170ea3c5 add missing copyright header for opentelemetry-instrumentation-redis (#3976)
* add missing copyright header for opentelemetry-instrumentation-redis

* add changelog entry
2025-11-28 09:14:11 +01:00
Riccardo Magliocchetti
5279805f58 opentelemetry-instrumentation: add support to skip all the available instrumentations (#3967)
* opentelemetry-instrumentation: add support to skip all the available instrumentations

Introduce support for skipping all the available instrumentation with a wildcard *.

e.g. OTEL_PYTHON_DISABLED_INSTRUMENTATIONS="*"

* Add changelog
2025-11-25 16:14:59 +00:00
Riccardo Magliocchetti
c284e221d7 instrumentation-google-genai: simplify event attributes assertions in tests (#3973) 2025-11-25 17:07:10 +01:00
otelbot[bot]
3335e96ce9 Update opentelemetry-instrumentation-openai-v2 version to v2.3b0 (#3970)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-11-25 10:37:28 +01:00
Riccardo Magliocchetti
2d8ee8e5f5 openai-v2: handle NotGiven values in request parameters (#3926)
* fix: remove attributes where the value is NOT_GIVEN in openai-v2 instrumentation for chat.completions.create operations

* Generalize check for instances of NotGiven

* Test embeddings for NotGiven values

* Bump tested openai version to latest

* Add a test README for giving hints on recording tests cassettes

* Fix lint

* Fix CI for oldest

* Add missing type

* Stick to older jiter for PyPy

* Move test README in tests

* Add response_service_tier to test assertion

---------

Co-authored-by: bkawecki <bkbkawecki@gmail.com>
2025-11-25 09:46:00 +01:00
Jackson Weber
a2ca6af9c9 Add Support for Detecting Synthetic Source (#3674) 2025-11-24 13:48:17 -08:00
Aaron Abbott
185502b3f8 Add lmolkova to approvers (#3960)
* Add lmolkova to approvers

* Update README.md

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-24 16:55:23 +00:00
Piotr Jeż
015163c69b opentelemetry-instrumentation-django: improve docs for response_hook with examples of providing attributes from middlewares (#3923)
* instrumentation/django: improve docs for response hooks

* changelog

* modify new sections as subsections under "Request and Response hooks"

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-24 15:33:49 +00:00
Teja
337a9868e2 openai-v2: Fix service tier attribute names (#3952)
* fix: Fix service tier attribute names in openai-v2 instrumentation

* polish: extracting service_tier from extra_body.

* Extract service_tier from extra_body when not in kwargs

In OpenAI SDK 1.26.0, service_tier is passed via extra_body.
Update get_llm_request_attributes to check both kwargs and extra_body
for service_tier to support both ways of passing it.

* Add changelog entry for service tier attribute fix

Fix #3920: Add changelog entry documenting the fix for service tier
attribute names.

* wip: adding checks for service_tier.

* wip: fix linting errors.

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-24 09:43:27 +01:00
Tammy Baylis
e95c19d0a7 Fix FlaskInstrumentor exemplars generation for http.server.(request.)duration (#3912)
* Fix FlaskInstrumentor http.server.request.duration exemplars

* Fix FlaskInstrumentor http.server.duration exemplars

* Add unit test

* Changelog

* lint

* Add flask functional test for exemplars

* lint

* More docker-test deps

* More concise

* Refactor metrics_context assignment, update test

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-21 10:46:38 +00:00
Hector Hernandez
38bc548784 Rename InMemoryLogExporter to InMemoryLogRecordExporter (#3589)
* Rename InMemoryLogExporter to InMemoryLogRecordExporter

* Remove added file

* Update

* Remove alias

* Update

* Added backward compatibility in imports

* Lint

* Lint

* Lint for real this time :)
2025-11-21 09:31:07 +01:00
Lukas Hering
ccea42c9fb opentelemetry-instrumentation-aiohttp-client: fix metric attribute leakage (#3936)
* opentelemetry-instrumentation-aiohttp-client: fix metric attribute leakage

* opentelemetry-instrumentation-aiohttp-client: add tests verifying isolation of metric attributes

* update tests and CHANGELOG.md

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-20 15:37:01 +00:00
Elyahou Ittah
44216702a2 opentelemetry-instrumentation-redis: implement suppression of instrumentation in Redis commands and pipelines (#3955)
* opentelemetry-instrumentation-redis: implement suppression of instrumentation in Redis commands and pipelines

- Added `suppress_instrumentation` context manager to allow selective disabling of instrumentation for Redis commands and pipelines.
- Updated the Redis instrumentation to check if instrumentation is enabled before executing commands.
- Added unit tests to verify the functionality of the suppression feature for both synchronous and asynchronous Redis operations.

* Doc

* Ruff

* Disable too-many-public-methods for tests file

* Update instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/__init__.py

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-20 15:20:31 +00:00
Lukas Hering
03c39cfd5b opentelemetry-instrumentation-aiohttp-client: update instrumentor to respect http instrumentation suppression (#3957)
* fix aiohttp-client to respect http instrumentation suppression

* update CHANGELOG.md
2025-11-20 09:34:55 +01:00
Keith Decker
96a9d0f0c9 GenAI Utils | Add more SemConv Attributes (#3862)
* feature: add genai llm request semconv attrs

* feat: add response attributes to LLM invocation spans

* fix inconsistent attrs on fail/stop

* add changelog

* fix: update version for semconvs

* fix: clean up nits

* refactor: redo type hints to use built-in generic types, remove optional typing

* feat: deduplicate finish reasons in LLMInvocation attributes
2025-11-18 22:58:59 -05:00
Lukas Hering
1d97282977 opentelemetry-instrumentation-redis: add default span name for pipeline operations (#3941)
* opentelemetry-instrumentation-redis: add default span name for pipeline operations

* update CHANGELOG.md

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-18 13:57:45 +00:00
Lukas Hering
fcbe18dece opentelemetry-instrumentation-pymongo: fix invalid mongodb collection attribute type (#3942)
* opentelemetry-instrumentation-pymongo: fix invalid mongodb collection attribute type

* update CHANGELOG.md
2025-11-18 11:13:56 +01:00
Aaron Abbott
3b97e365d2 Add environment variable for genai upload hook queue size (#3943) 2025-11-14 15:01:13 -05:00
Phillip Verheyden
8297dde4b4 Replace asyncio.iscoroutinefunction with inspect.iscoroutinefunction (#3880)
* Replace asyncio.iscoroutinefunction with inspect.iscoroutinefunction

Fixes #3879

* Fix import ordering

* aiokafka test workaround for CPython 3.9 bug

* Apply suggestions from code review

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-13 12:40:15 +01:00
Chris Toshok
8356368e99 pymongo: for CommandFailedEvent use the errmsg as the status description instead of the _DocumentOut (#3904)
* use the errmsg as the status description instead of the _DocumentOut

* fix the unit tests (in particular the test was mocking event.failure as a str, when that's not what the type is)

* reformat, fix tests

* add changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-13 11:33:19 +00:00
Luke (GuangHui) Zhang
4f89e758b1 fix: suppress ruff PLC0415 for conditional gevent import (#3842)
The generate_instrumentation_bootstrap.py script was failing with a
ruff linting error (PLC0415: import should be at top-level) when
checking the auto_instrumentation module.

Add noqa comment to suppress this error for the gevent monkey patch
import, which is intentionally inside a try-except block for
conditional loading. This allows the bootstrap generation script
to complete successfully.
2025-11-13 12:23:10 +01:00
DylanRussell
123f55615d Fix a few bugs in opentelemetry-instrumentation-google-genai instrumentation package (#3905)
* Fix a few bugs in gen AI instrumentation

* Make a lot of changes

* Remove print statements

* fix lint issues

* remove added folder

* Address comments

* Move code into helper

* Revert change to pyright include
2025-11-12 13:08:49 -05:00
Minje Park
bd3c1f2aa2 enhance elasticsearch body sanitization (#3919)
* enhance elasticsearch body sanitization

* update CHANGELOG.md

* fix failed tests

* reformat test_elasticsearch.py

* fix elasticsearch integration test

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-10 09:20:49 +00:00
Emídio Neto
2d42884774 Add dev dependency group with tox-uv and pre-commit (#3927)
* testing

* Add dev dependency group with tox-uv and pre-commit

* fix
2025-11-07 16:14:28 -05:00
Aaron Abbott
da63c967f8 Fix overwritten log attributes in vertexai instrumentation (#3925) 2025-11-07 10:12:52 -05:00
Drew Robbins
fecd8afac9 Add OpenAI embeddings instrumentation (#3461)
* Initial implementation and tests

* Add embeddings example

* Update documentation

* Changelog entry

* Add comment about custom attributes

* Update PR link in Changelog

* Add input and output events for embeddings

* Fix changelog

* Use gen_ai.embeddings.dimension.count

* Remove total_tokens

* Use end_on_exit

* Don't import conditionally

* Fix heading

* Use gen_ai.request.encoding_formats

* Use gen_ai.request.encoding_formats

* Rename span_attr to request_attr

* Remove embeddings capture via events

* bump versions

* Remove unused event code

* Updates for PR feedback

* Update requirements for example

* dimension.count is added in get_llm_request_attributes

* Use a shared function to reduce duplicate code

* remove return

* Update instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/requirements.txt

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-06 09:16:05 +01:00
Riccardo Magliocchetti
9515f0419e aiohttp-server: add support for headers capture for request and response (#3916)
* Collect request attributes once

* Doen't add request attributes to span if it is not recording

While at it also avoid copying empty dictionaries

* Add support for collecting custom request and response headers

* update type annotations

* Add changelog

* Add PR number in changelog

* Add documentation

* Apply suggestions from code review

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
2025-11-04 08:39:25 +00:00
Riccardo Magliocchetti
fd5ddf0b9c opentelemetry-util-genai: skip flaky upload test on pypy (#3918)
* opentelemetry-util-genai: skip flaky upload test on pypy

* Update util/opentelemetry-util-genai/tests/test_upload.py

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

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-11-04 08:31:01 +00:00
Riccardo Magliocchetti
77eca7d35b instrumentation/: Fix link to http server span semantic conventions (#3917)
* instrumentation/: Fix link to http server span semantic conventions

* Update instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
2025-11-04 08:27:29 +00:00
Tammy Baylis
192334315a Improve psycopg2, psycopg readthedocs on sqlcommenter (#3882)
* Update psycopg2,psycopg docs on sqlcommenter

* changelog

* Fix table format

* Fix underline

* Fix quotes

* Add warning about db.statement cardinality

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-11-03 11:55:35 +01:00
Riccardo Magliocchetti
d9b40bee39 Add missing OTEL_PYTHON_EXCLUDED_URLS documentation (#3836)
* tornado: cite the instrumentation also handles OTEL_PYTHON_EXCLUDED_URLS

* aiohttp-server: document OTEL_PYTHON_EXCLUDED_URLS configuration

* Add test for aiohttp-server

And make the implementation testable

* Assert metrics in aiohttp-server tests

* Please pylint

* Initialize tracer, meter and excluded urls at instrument time

So they are testable

* Add changelog

* Update instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/__init__.py
2025-11-03 10:06:01 +01:00
Tammy Baylis
5a15f57588 Fix aiohttp instrumentors' readmes (#3902)
* Fix aiohttp instrumentor readmes

* Changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-10-31 15:33:05 +00:00
Tammy Baylis
31b2e4aeee Improve Django readthedocs on sqlcommenter (#3884)
* Improve Django sqlcomment readthedocs

* Changelog

* Update instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/__init__.py

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

* Update instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/__init__.py

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-10-31 15:17:01 +00:00
Philip Meier
c6ae8e5de3 opentelemetry-exporter-richconsole: prevent deadlock (#3900)
* prevent deadlock

* fix changelog

* lint

* add test timeout
2025-10-31 14:16:34 +00:00
DylanRussell
5ea0a71483 Check LRU cache before acquiring the semaphore/thread to upload a file (#3907)
* initial commit

* Add changelog

* Respond to comments
2025-10-31 09:37:49 -04:00
Tammy Baylis
447aac2b0f Improve PyMySQL, mysqlclient, mysql-connector instrumentor docs' sqlcommenter info (#3885)
* Update PyMySQL docs

* Update mysql-connector, mysqlclient docs around sqlcommenter

* Changelog

* Add warning about db.statement cardinality

* whitespace

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-10-30 16:03:20 +00:00
Tammy Baylis
425da56e3c Improve sqlalchemy docs sqlcommenter info (#3886)
* Improve sqlalchemy sqlcomment docs

* Changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-10-30 15:39:32 +00:00