2384 Commits

Author SHA1 Message Date
b5a0ee526c opentelemetry-instrumentation-system-metrics: add process metrics (#3250)
* opentelemetry-instrumentation-system-metrics: add process metrics

Add process metrics as of 1.30.0 semconv to the system metrics instrumentation.
We still keep around the old process.runtime metrics because the semconv
suggest to not break current users. Still discourage their use in the
doc and state explicitly they are deprecated.

* Add Changelog

* Please pylint

* Apply suggestions from code review

* Remove print

* Remove process.count and fix system metrics enumeration in tests

* Cleanup metrics presence assertions

* Don't touch system metrics descriptions

* Add default for num_cpu in case it returns None to avoid division error
2025-02-21 09:04:15 +00:00
17a57bf6d3 Fix openaiv2 example readme (#3276)
* Fix openaiv2 example readme

* update manual as well

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-21 08:46:28 +00:00
2f5b0bf1fc Vertex capture tool requests and responses (#3255)
* Vertex capture tool requests and responses

* Update to use tracking bug in contrib repo
2025-02-20 23:32:19 +00:00
6245fb833c Use UV to install all needed packages locally (#3124)
* Use UV to install all needed packages locally

* Add opentelemetry-test-utils

* Add asgi and fastapi

* Add more projects, since it helped me

* add urllib

* Add system metrics

* Add dbapi and sqlite3

* Add sqlalchemy

* add pyramid

* Add pymongo

* Add jinja2

* add lock file

* add falcon as well

* Add uv lock to the pre-commit

* Update uv.lock

* Update lockfile

* remove xray test dependencies

* Add otel-sdk to xray

* Update uv version

* Drop xray from the list of packages

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-02-20 17:04:31 -05:00
8644630e7f opentelemetry-instrumentation-system-metrics: add support for psutil 7 (#3277) 2025-02-20 15:33:00 +01:00
52bbcd6001 Add FOSSA scanning workflow (#3270)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2025-02-20 10:21:51 +01:00
8e3cd65f28 build(deps): bump certifi in /tests/opentelemetry-docker-tests/tests (#3262)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.2.2 to 2024.7.4.
- [Commits](https://github.com/certifi/python-certifi/compare/2024.02.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  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-02-19 15:45:40 +00:00
0cb9ba55e8 [chore] Replace '-0' and '-1' with semantically meaningful suffixes. Other minor fixes in 'instrumentation-genai' test structure. (#3268)
* Replace '-0' and '-1' with semantically meaningful suffixes.

* Act on feedback in PR 3268.

* Fix typos.
2025-02-19 16:25:07 +01:00
96f4a039c5 docs(readme): current section links (#3269)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-02-17 11:22:15 +00:00
789bf866e3 botocore: handle system messages events (#3266)
* botocore: handle system event messages

* Add CHANGELOG

* Please pylint
2025-02-14 10:17:08 +00:00
1623dc0e71 fixed: asyncpg connection params are a namedtuple (#3253)
Follow-up on the apparently abbandonned https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2114.

The asyncpg instrumentation attempts to fall back on using the database
name as the span name in case the first argument to the instrumented
method is falsey.

This has probably never worked since asyncpg defines the `_params`
attribute as an instance of `ConnectionParams`
(https://github.com/MagicStack/asyncpg/blob/master/asyncpg/connection.py#L62)
which is a NamedTuple instance and thus don't define `get`. The proper
way of safely accessing properties on a NamedTuple is using `getattr`.

The only case that I've actually found which triggers this branch is if
the supplied query is an empty string. This is something that causes an
`AttributeError` for `Connection.execute` but is fine for `fetch()`,
`fetchval()`, `fetchrow()` and `executemany()`.

The tests have been expanded to check these cases. Also, more status
code validation has been added where it was missing.

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-14 08:59:21 +00:00
63e43d5222 [threading] Remove ellipsis from type hints (#3245)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-13 09:38:12 +00:00
95873604ab botocore: add bedrock genai user events and lazy initialize tracers and event loggers (#3258)
* Create per-extension tracers if there's an extension available

* botocore: add user events for bedrock

* Remove pass of AWS env vars from tox.ini

* Remove handling for other types of messages

* Please pylint

* Add changelog

* Update CHANGELOG.md

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

---------

Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
2025-02-13 10:08:24 +01:00
34368612f4 Update .readthedocs.yml (#3264) 2025-02-12 14:54:01 +01:00
bf3c0be507 build(deps): bump cryptography (#3259)
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.5 to 44.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.5...44.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  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: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-02-12 12:28:50 +01:00
42e8b0a451 upgrade opentelemetry-exporter-prometheus-remote-write to use protobuf 5.26 (#3219)
* Allow protobuf version above 4 and under 6 for opentelemetry_exporter_prometheus_remote_write

* update version

* fix tests

* regenerate protobufs

* with newer protoc

* format

* actually support 5.26 protobuf

* changelog

* Update CHANGELOG.md

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

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-02-11 21:32:27 +00:00
6e61ff0c32 VertexAI stop serializing unset fields into event (#3236) 2025-02-10 15:36:23 -05:00
231d26c4be Provide advisory histogram boundaries when creating OpenAI metrics (#3225)
* small fixes in OpenAI examples

* up

* add comment

* leverage histogram bucket advice in 1.30

* Update instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_metrics.py

* Update instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_chat_metrics.py

* up

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-10 09:09:52 -08:00
c0bc2c9797 Add Vertex gen AI response attributes and gen_ai.choice events (#3227)
* Add Vertex gen AI response span attributes

* Vertex response gen_ai.choice events

* Add todo comment

* Update _map_finish_reason() and use it in span attribute as well

* ruff
2025-02-07 23:05:07 +00:00
64f28ca279 docs: add request_hook parameter description to RedisInstrumentor (#3247)
* docs: add request_hook parameter description to RedisInstrumentor

* changelog: add missing entry in doc string for _instrument in opentelemetry-instrumentation-redis

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-02-07 11:29:28 -05:00
d7bc137c60 openai: fix broken link (#3248) 2025-02-07 11:10:00 +00:00
cca571ab72 Record content events regardless of span sampling decision (#3226)
* Record content events regardless of span sampling decision

* changelog

* feedback

* ruff

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-06 13:28:02 +00:00
6b3a11beb2 Render strings in bedrock test cassettes for readability (#3243) 2025-02-06 10:06:05 +01:00
9d8a6c6420 infra: fix workflows (#3240) 2025-02-04 13:24:34 -08:00
85e21a9e22 Update version to 1.31.0.dev/0.52b0.dev (#3233) 2025-02-04 12:55:11 -08:00
d18c5fe19c add vertexai to eachdist (#3230) 2025-02-03 13:01:37 -08:00
65a2713d9f Add mysql-connector instrumentor support for sqlcommenting (#3163) 2025-01-30 09:43:17 -08:00
748c92592d VertexAI emit user, system, and assistant events (#3203)
* VertexAI emit user events

* Emit system and assistant events

* Fix for python 3.8

* Record events regardless of span recording

* fix tests

* 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-01-29 22:24:39 +00:00
7af1918b89 botocore: remove amazon copyright from bedrock_utils (#3215)
These code has been written from scratch
2025-01-28 20:22:56 +00:00
44754e2a50 botocore: handle exceptions when consuming EventStream in bedrock extension (#3211) 2025-01-28 19:55:40 +00:00
731054f736 Add server attributes to Vertex AI spans (#3208) 2025-01-28 16:46:13 +00:00
dd68241907 fix pymssql entry_point for auto-instrumentation (#3214)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-28 14:05:19 +00:00
eabab7d0ad Fix changelog (#3213) 2025-01-28 14:31:11 +01:00
93e6fcfa26 botocore: add basic tracing for Bedrock InvokeModelWithStreamResponse (#3206)
* Add basic tracing for InvokeModelWithResponseStream

* Add changelog and please pylint
2025-01-28 09:55:28 +01:00
5478a0b77a Add pymssql instrumentation (#394)
* Add pymssql instrumentation

* Run tox -e generate

* tox -e generate-workflows

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-27 16:12:21 +01:00
0bb1c42a78 botocore: add basic tracing for bedrock ConverseStream (#3204)
* Add tracing for ConverseStream

* Add converse stream example
2025-01-27 10:01:07 +01:00
2756c1edff botocore: add basic handling for bedrock invoke.model (#3200)
* Add basic handling for invoke.model

* Add changelog a please pylint

* Record converse cassettes against us-east-1

* Avoid double copy of streaming body

---------

Co-authored-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
2025-01-23 17:14:49 +01:00
ec3c51dcd1 Added Vertex AI spans for request parameters (#3192)
* Added Vertex AI spans for request parameters

* small fixes, get CI passing

* Use standard OTel tracing error handling

* move nested util

* Actually use GAPIC client since thats what we use under the hood

Also this is what LangChain uses

* Comment out seed for now

* Remove unnecessary dict.get() calls

* Typing improvements to check that we support both v1 and v1beta1

* Add more teest cases for error conditions and fix span name bug

* fix typing

* Add todos for error.type
2025-01-22 13:32:34 -05:00
3f50c08580 psycopg2-binary support (#3186)
* psycopg2-binary support

* changelog

* Update CHANGELOG.md

* Update pyproject.toml

* fix

* lint

* added test config

* Update bootstrap_gen.py

* update tox

* Update tox.ini

* regenerate workflows

* workflows

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-21 15:41:56 -05:00
37f85bf8cc instrumentation/aws-lambda: don't print warnings outside of AWS Lambda (#3183)
If we are not running inside AWS Lambda don't print warnings on missing
OTel lambda extension layer.
The instrumentation is installed by the OTel k8s operator and so this
warning may confuse users.
2025-01-21 13:57:53 +00:00
20413ef7d7 Copy changelog updates from package-release/opentelemetry-instrumentation-openai-v2/v2.1bx (#3197)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-21 09:10:48 +01:00
9460773e5c Basic instrumentation for Bedrock runtime Converse api (#3161)
* botocore: add extension for bedrock runtime api

* Add tests and handle only non streaming responses

* Make it explicit we are handling only the converse operation

* Simplify test since all models behaves the same

* Add test for error case and rework things a bit

* Add converse example

* Generate workflows

* Add changelog
2025-01-20 09:56:09 +01:00
86a7f6bab3 Update opentelemetry-instrumentation-openai-v2 version to v2.2b0 (#3194) 2025-01-17 20:12:12 -08:00
9b217bb4ff introducing tox-uv for real (#3185)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-01-17 17:33:52 +01:00
9d9353d4c6 Run pyright on Vertex AI instrumentation (#3184) 2025-01-16 14:25:35 -05:00
a716949d1c Add metrics to the Python OpenAI instrumentation (#3180) 2025-01-15 14:24:35 -08:00
07c97eac38 Add type hints to psycopg (#3067)
* Add type hints to Psycopg

* fix tests

* fix

* Add psycopg.Connection to nitpick

* Add py.typed

* add psycopg to nitpick again

* add psycopg to nitpick again

* move py.typed to the right folder

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-15 16:30:01 +00:00
52871b82b6 Add type hints to HTTPX (#3098) 2025-01-14 09:27:35 -08:00
e54256ddb7 Support PEP 561 to opentelemetry-instrumentation-urllib (#3131)
* Support PEP 561 to `opentelemetry-instrumentation-urllib`

* add future

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-01-14 16:28:11 +00:00
c59b514cda Fix component owner workflow permissions (#3165) 2025-01-13 15:42:32 -08:00