1595 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
8644630e7f opentelemetry-instrumentation-system-metrics: add support for psutil 7 (#3277) 2025-02-20 15:33:00 +01: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
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
6b3a11beb2 Render strings in bedrock test cassettes for readability (#3243) 2025-02-06 10:06:05 +01:00
85e21a9e22 Update version to 1.31.0.dev/0.52b0.dev (#3233) 2025-02-04 12:55:11 -08:00
65a2713d9f Add mysql-connector instrumentor support for sqlcommenting (#3163) 2025-01-30 09:43:17 -08: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
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
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
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
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
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
5219242eaf Support PEP 561 to opentelemetry-instrumentation-wsgi (#3129) 2025-01-13 13:32:16 -08:00
b7e7d0cbe5 Implement new HTTP semantic convention opt-in for Falcon (#2790) 2025-01-13 11:49:22 -08:00
406707b2bd Add type checker (#3116) 2025-01-13 09:20:33 -08:00
8406e2e789 DB drivers: db.statement inclusion of sqlcomment as opt-in (#3121)
* db-api opt-in for enable_attribute_commenter

* Refactor db-api traced_execution

* Changelog

* Update comment

* psycopg(2), mysqlclient, pymysql support enable_attribute_commenter

* Changelog
2025-01-13 10:40:43 +01:00
29ef6a9455 Add type hints to dbapi (#3068) 2025-01-10 10:03:09 -08:00
3ebdb6344b Support PEP 561 to opentelemetry-instrumentation-pymongo (#3136) 2025-01-10 09:20:28 -08:00
a606fab849 Support PEP 561 to opentelemetry-instrumentation-requests (#3135) 2025-01-10 09:00:10 -08:00
0ad779a5b3 Support PEP 561 to opentelemetry-instrumentation-jinja2 (#3137) 2025-01-09 17:42:12 -08:00
962a3aecdb fix #991 audit asyncpg instrumentation with nooptracerprovider (#3144) 2025-01-09 14:51:23 -08:00
cf6d45e96c DB-API: db.statement inclusion of sqlcomment as opt-in (#3115) 2025-01-09 13:08:46 -08:00
26bcc9347b SQLAlchemy: db.statement inclusion of sqlcomment as opt-in (#3112) 2025-01-09 12:56:14 -08:00
908437db5d click: ignore click based servers (#3174)
* click: ignore click based servers

We don't want to create a root span for long running processes like servers
otherwise all requests would have the same trace id which is unfortunate.
---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
2025-01-09 11:29:31 +01:00
3d5935f4f6 docs: add missing import to aws-lambda (#3154) 2025-01-02 12:18:07 -08:00
95f14cd8df wsgi: always record span status code to have it available in metrics (#3148) 2025-01-02 11:58:17 -08:00
3e394a4814 Support PEP 561 to opentelemetry-instrumentation-system-metrics (#3132) 2025-01-02 11:30:41 -08:00
16c041e22b Support PEP 561 to opentelemetry-instrumentation-sqlite3 (#3133) 2025-01-02 11:15:01 -08:00
54882871b9 add official support to Python 3.13 (#3134)
* add py313 to tox

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

* fix wrong identation troveclassifiers

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

* fix pyramid, django

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

* fix httpx

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

* fix httpx, grpc and add vertex

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

* generate-workflows

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

* fix generate-workflows

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

* fix celery and psycopg

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

* add changelog

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

* Update CHANGELOG.md

* Update tox.ini

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-31 16:08:20 +00:00
16eaec8d03 cassandra: fix tests for py313 (#3152)
* cassandra: fix tests to make CI happy for py313

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

* ruff

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

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-24 16:14:05 +01:00
396aad9c24 celery: remove deprecated import of ContextManager from typing (#3145)
* celery: remove deprecated import of ContextManager from typing

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

* add type checking

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

* ruff

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

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-24 13:55:33 +00:00
375eb6f2cc psycopg: bump versions in test-requirements to support py313 (#3147)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-24 13:47:18 +00:00
b03bf0037f asyncpg: bump version in test-requirements (#3146)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-23 17:47:09 +00:00
2176e3e43e opentelemetry-instrumentation-falcon: expand supported version to v4 (#3086)
* opentelemetry-instrumentation-falcon: expand supported version to v4

Falcon v4 has a mostly identical interface to v3, and is proved to be fully compatible with `opentelemetry-instrumentation-falcon`. Loose the version check to `<5.0.0` to avoid false `DependencyConflict` alarm.

* opentelemetry-instrumentation-falcon: generate tests for v4

* opentelemetry-instrumentation-falcon: prepare tests for v4

* opentelemetry-instrumentation-falcon: add test preset for `~=3.1.2`

* docs: add changelog for Falcon v4 instrumentation

* opentelemetry-instrumentation-falcon: adjust pylint mark for v4

* _has_fixed_http_target property

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

* move changelog to the correct section

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

* fix test and bootstrap_gen

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

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-23 17:34:48 +00:00
77708cd7dd grpc: bump grpcio version in test-requirements (#3140)
* grpc: bump grpcio version in test-requirements

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

* keep 1.62.0 test

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

* fix toxini

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

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-23 13:36:12 +01:00
73ecf39517 sqlalchemy: bump greenlet version in test requirements and use last requirement file for lint (#3139)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-23 10:09:27 +00:00
1092344918 Add docstring for instrument_connection() and tests for database drivers (#3108) 2024-12-20 12:24:46 -08:00
54cbf59aae Update package metadata adding "Repository" to project urls (#3119)
Add "Repository" label to project urls pointing to the
opentelemetry-python repo root url.

Having within project urls one entry with the same value for all
packages released by the project will help tools for automatic
dependency management to suggest coherent upgrades for related packages.
2024-12-19 10:15:58 +00:00
52ff7bdd4b feat: Update opentelemetry-instrumentation-confluent-kafka to support confluent-kafka <=2.7.0 (#3100) 2024-12-17 12:33:39 -08:00