Compare commits

...

588 Commits

Author SHA1 Message Date
OpenTelemetry Bot 109173fec7
Update version to 1.36.0.dev/0.57b0.dev (#3633) 2025-07-11 14:35:47 +02:00
Emídio Neto b63ca133be
Update CHANGELOG.md (#3632) 2025-07-11 13:33:10 +02:00
OpenTelemetry Bot 1f78c8acff
Sort contributor listings and remove affiliation from emeriti (#3627)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-07-11 09:20:33 +00:00
Mike Dearman 49fa53131d
Add tornado WebSocketHandler instrumentation support (#3498)
* Add tornado WebSocketHandler instrumentation support. (https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2761)

* Linting

* Update CHANGELOG.md

* Apply refactor changes from #3582

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-07-10 17:41:36 +02:00
OpenTelemetry Bot 333fc5dcb4
Update opentelemetry-instrumentation-google-genai version to v0.4b0 (#3619) 2025-07-08 14:46:08 -04:00
warmagedon007 80c357bb16
pika: added instrumentation for pika.connection.Connection and pika.c… (#3584)
* pika: added instrumentation for pika.connection.Connection and pika.channel.Channel, thus added instrumentation support to all SelectConnection adapters.

* updated changelog.

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-07-07 08:17:31 +00:00
Prajna Paramita Biswal 3c4d18cc13
ref(mysql): remove SpanAttributes (#3616)
* ref(mysql): remove SpanAttributes

* fix imports
2025-07-07 09:43:47 +02:00
Radoslav Kirilov b74633a552
feat(pymongo): aggregate and getMore capture statements support (#3601)
* feat(pymongo): aggregate and getMore capture statements

* chore: update changelog

* fix: tests

* fix: proper MockCommand and expectations

* chore: ruff-format
2025-07-02 07:23:51 +00:00
Carlos RC b1c2c7941b
fix excluded_urls in instrumentation-asgi (#3567)
* fix excluded_urls in instrumentation-asgi

* fix ExcludeList or str

* chhangelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-07-01 12:33:01 +00:00
rads-1996 b69ebb7224
Redact specific url query string values and url credentials in instrumentations (#3508)
* Updated the instrumentation with aiohttp-server tests for url redaction

* Updated the aiohttp-server implementation and the query redaction logic

* Updated changelog and moved change to unreleased. Updated test files with license header

* Improved formatting

* Fixed failing tests

* Fixed ruff

* Update util/opentelemetry-util-http/src/opentelemetry/util/http/__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-07-01 12:26:47 +00:00
Andre Murbach Maidl 6977da3893
Improve asgi instrumentation example (#3576)
* Improve asgi instrumentation example

* Fix indentation of asgi instrumentation example

* Improve type hints of asgi instrumentation example

* Ignore pylint too-many-lines

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-30 11:03:50 +02:00
Ezzio Moreira ca079cbc56
feat: change semcov util/opentelemetry-util-http (#3592) 2025-06-30 08:21:28 +00:00
OpenTelemetry Bot 40d8942bf5
Update community member listings (#3595)
* Update community member listings

* Fix outdated community membership link

---------

Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
2025-06-30 08:14:08 +00:00
Emídio Neto 78300e9642
Update CHANGELOG.md (#3593) 2025-06-26 12:01:51 +02:00
shwejan raj c4347e027c
adds NoOpTracerProvider test case for falcon instrumentation (#3382)
Signed-off-by: Shwejan Raj, Bhupathi <Bhupathi.ShwejanRaj@fmr.com>
Signed-off-by: Bhupathi Shwejan Raj <Bhupathi.ShwejanRaj@fmr.com>
2025-06-17 16:16:26 +00:00
f-kanari-safie 0a03c9abf2
refactor(tornado): replaces SpanAttributes by semconv attributes (#3582)
* refactor: fix import paths

* fix imports

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-16 12:09:38 +00:00
Andre Murbach Maidl 85dbfe520a
Improve grpc instrumentation examples (#3575) 2025-06-16 09:31:12 +00:00
Andre Murbach Maidl b27225273b
Improve wsgi instrumenation example (#3577) 2025-06-16 09:06:34 +00:00
Andre Murbach Maidl 591051f8bb
Improve pyramid instrumentation example (#3578)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-16 08:42:59 +00:00
Riccardo Magliocchetti 50cdeeee12
resource-detector-containerid: demote failure to read cgroup files to debug (#3579)
* resource-detector-containerid: demote failure to read cgroup files to debug

Make the detection more quiet so we can load it on application not
running on linux machines without spamming logs.

* Add changelog
2025-06-16 10:33:16 +02:00
Riccardo Magliocchetti 04f8899252
docs: update redis-py documentation link (#3581) 2025-06-13 10:01:16 -03:00
OpenTelemetry Bot 59cc34e9f3
Update version to 1.35.0.dev/0.56b0.dev (#3556) 2025-06-04 16:53:03 +02:00
Phillip Verheyden b7301823a0
Allow reraising the root exception if instrumentation fails (#3545)
* Allow reraising the root exception if instrumentation fails

I would rather completely fail startup in my services if instrumentation fails for whatever reason instead of just logging an exception and continuing.

Use case:

from opentelemetry import autoinstrumentation

autoinstrumentation.initialize(swallow_exceptions=False)

* Fix lint

* Type hinting, re-raise original exception

* One more type hint to indicate None return

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-04 08:44:45 +00:00
Emídio Neto 4a21b3974b
resource-dector-container: package rename to `opentelemetry-resource-detector-containerid` (#3536)
* resource-dector-container: package rename

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

* fix ruff

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

* change entrypoint

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

* fix

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

* fix test

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

* fix for entrypoint name

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>
2025-06-04 10:41:38 +02:00
Artem Ziborev 85ea8f382d
refactor(grpc): replace SpanAttributes with semconv attributes (#3540)
* refactor(grpc): replace SpanAttributes with semconv attributes

* refactor(flask): replace SpanAttributes with semconv attributes (fix ruff linting)

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-03 15:31:50 +00:00
Sean Hood 8f7bab5337
Fixes container detector for systemd & cgroupv1 with Docker (#3429)
* Fixes container detector for systemd & cgroupv1 with Docker

* Update CHANGELOG

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-03 15:27:09 +00:00
Hector Hernandez ccf9cabeee
feat(instrumentation-httpx): Add support for HTTP metrics (#3513)
* Add support for metrics

* Updated changelog

* Update package.py

* generate and lint

* Update

* Update

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-06-03 14:00:38 +00:00
Dmitriy 701d65b022
feat: support batch (getmany) in aiokafka instrumentation (#3257)
* feat: support batch (getmany) in aiokafka instrumentation

* test: fix unclosed resources and typing

* test: add test_wrap_getmany

* fix: get unique topic list in batch

* fix: update typing, run pyupgrade

* fix: remove json.dumps from SERVER_ADDRESS attribute

* fix pylint

* fix: sync span_kind with spec

* add CHANGELOG entry

* remove changes not from this issue

* move types under TYPE_CHECKING

* move CHANGELOG entry to unreleased

* enable pyright for aiokafka, fix key type

* Update CHANGELOG.md

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-06-03 13:52:00 +00:00
Anuraag (Rag) Agrawal b9a78e7475
opentelemetry-instrumentation-starlette: fix memory leak and double middleware (#3529)
* opentelemetry-instrumentation-starlette: fix memory leak and double middleware

* Changelog

* Update CHANGELOG.md

Co-authored-by: Joe McGinley <116890464+jomcgi@users.noreply.github.com>

---------

Co-authored-by: Joe McGinley <116890464+jomcgi@users.noreply.github.com>
2025-06-03 15:47:35 +02:00
Marc 77325aa89a
fix: respect supress_instrumentation functionality in sqlalchemy instrumentation (#3477)
* respect supress_instrumentation

* update changelog

* Update CHANGELOG.md

Fix changelog after release

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-30 16:00:27 +00:00
Naofumi MURATA 6d8becf9ad
feat: respect supress_instrumentation functionality in dbapi instrumentation (#3460)
* respect supress_instrumentation

* update CHANGELOG

* fix link

* update CHANGELOG

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-30 17:49:29 +02:00
Andy Vu 6c89a56da5
replaced all uses of spanattributes in wsgi (#3546)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-29 16:09:04 +00:00
Riccardo Magliocchetti 3e0632cb31
opentelemetry-instrumentation-botocore: fix handling of tool input chunked json in bedrock converse_stream (#3544)
* opentelemetry-instrumentation-botocore: fix handling of tool input chunked json in converse_stream

We need to accumulate all the tool input as string before decoding it
otherwise we may end up with invalid json.

* Add changelog

* Remove leftover print

* No need for too-many-statements disable
2025-05-29 09:51:38 +02:00
Srdjan Lulic 7bd0895d01
botocore: add dict type check before parsing tool_use from Bedrock messages (#3548)
Amazon Bedrock tool use extraction logic doesn't agree with som of the use cases (conversation construction), such as the case with pre-created assistant message: 

'messages': [{"role": "user", "content": "Placeholder text."}, {"role": "assistant", "content": "{"}],

This PR addresses this by adding a dict type check on the message content before attempting to get the value of `tool_use`from the content.
2025-05-28 14:17:33 +02:00
Hector Hernandez a912c9e57c
feat(instrumentation-aiohttp-client): Add support for HTTP metrics (#3517)
* Add metrics support

* Update instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

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

* Update instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

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

* Update instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

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

* Adding tests, updating changelog

* Adding server address and port to both spans and metrics

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-27 20:41:00 +00:00
wesley 75c73d1e29
refactor aws lambda span (#3541)
* refactor: migrate http_attributes from SpanAttributes to new semantic conventions and refactor tests

* fix precommit linting

* refactor aws lambda to use new semantics

* refactor tests

* update resourceattributes to cloud attrs

* update main for attrs
2025-05-27 20:30:47 +00:00
Joe McGinley a164d37a3c
Chore: Drop support for Python 3.8 (#3399)
Python 3.8 was EoL @ 2024-10-07, our 6 month promise for support ended on 2024-04-07.

Changes:
* Updated basline refs to 3.9
* Removed 3.8 sys.version_info checks
* Fixed botocore test failure
* Applied ruff formatting
2025-05-27 17:26:02 +02:00
Mattias De Charleroy e2ba6d43c0
starlette: Remove maximum version constraint (#3456)
* ISSUE-3317: Remove maximum version constraint on starlette, by fixing unit tests. Fixed some warnings in unit tests.

* Updae changelog

* Implement code review remarks: update starlette dependencies in bootstrap/test-requirements. Use setUp/tearDown iso decorator on test class

* Increase minimal version of starlette to 0.37.2 to have functional 'oldest' tests.

* add uv.lock

* Revert "add uv.lock"

This reverts commit 08df2bee1e.

* Prevent massive changes of uv.lock due to newer uv which adds upload-time keyword

* Update test-requirements.in file of starlette instrumentation

* fixes

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

* fix tests

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

* increase delta

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

* using same delta as fastapi

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

* commit uv.lock back

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

* Update CHANGELOG.md

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

* Update CHANGELOG.md

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-23 12:22:31 +00:00
wesley 4e42ed674a
refactor(boto): replace uses of SpanAttributes with opentelemetry.semconv.attributes (#3538)
* refactor: migrate http_attributes from SpanAttributes to new semantic conventions and refactor tests

* fix precommit linting

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-23 08:55:13 +00:00
Riccardo Magliocchetti 72f437c456
opentelemetry-instrumentation-system-metrics: fix running on Google Cloud Run (#3533)
* opentelemetry-instrumentation-system-metrics: fix running on Google Cloud Run

psutil fails reading context switches fails on Google Cloud Run, so
before setting up the observable counter trying to read the values check
we are actually being able to do so.

* Please pylint
2025-05-23 08:45:33 +00:00
Riccardo Magliocchetti 93353660f6
opentelemetry-instrumentation-urllib3: add explicit http duration buckets for stable semconv (#3518)
* opentelemetry-instrumentation-urllib3: add explicit http duration buckets for stable semconv

* Add Changelog

* Update CHANGELOG.md

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-23 08:42:18 +00:00
Riccardo Magliocchetti 1953d97958
opentelemetry-instrumentation-urllib: add explicit http duration buckets for stable semconv (#3519)
* opentelemetry-instrumentation-urllib: add explicit http duration buckets for stable semconv

* Update CHANGELOG.md

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-23 08:38:15 +00:00
Srdjan Lulic df275921a9
Ensure spans complete on early stream closure for Bedrock Streaming APIs (#3481)
* Ensure spans end on early stream closure for Bedrock Streaming APIs

* Add changelog

* End span only if it's still recording in stream done callbacks. Assert that span status is unset.

* Extract response output and stream content into helper functions

* Update changelog after 1.33.0 release

* Keep track of bedrock stream ending and close spans accordingly

* Move stream output checks to a single method

* Update CHANGELOG.md

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-23 08:33:00 +00:00
Christoph Heger c1a689507b
Refactor redis instrumentation to use semconv incubating attributes (#3534)
* Replaced usage of opentelemetry.semconv.trace with opentelemetry.semconv._incubating.attributes.

* Fixed ruff failure
2025-05-23 08:27:14 +00:00
Christoph Heger b3f98ab936
Replaced usage of SpanAttributes with opentelemetry.semconv._incubating.attributes. (#3535) 2025-05-23 08:13:09 +00:00
Riccardo Magliocchetti dc35754dbd
opentelemetry-instrumentation-falcon: add explicit http duration buckets for stable semconv (#3525) 2025-05-23 08:08:43 +00:00
Riccardo Magliocchetti fa6d972444
opentelemetry-instrumentation-wsgi: add explicit http duration buckets for stable semconv (#3527)
* opentelemetry-instrumentation-wsgi: add explicit http duration buckets for stable semconv

* Please pylint
2025-05-23 08:00:28 +00:00
Riccardo Magliocchetti 5e4b55812a
opentelemetry-instrumentation-asgi: add explicit http duration buckets for stable semconv (#3526)
* opentelemetry-instrumentation-asgi: add explicit http duration buckets for stable semconv

* Please pylint
2025-05-23 07:56:41 +00:00
Riccardo Magliocchetti 680f197515
opentelemetry-instrumentation-flask: add explicit http duration buckets for stable semconv (#3523)
* opentelemetry-instrumentation-flask: add explicit http duration buckets for stable semconv

* Update CHANGELOG.md

* Fix pylint
2025-05-23 07:49:08 +00:00
Riccardo Magliocchetti 1909c913b2
opentelemetry-instrumentation-django: add explicit http duration buckets for stable semconv (#3524)
* opentelemetry-instrumentation-django: add explicit http duration buckets for stable semconv

* Update CHANGELOG.md
2025-05-23 07:42:32 +00:00
Ivana Kellyer f9d9f19aa5
fix(grpc): Allow non-list interceptors (#3520)
* fix(grpc): Support non-list interceptors

The GRPC integration assumes that if interceptors are provided, they will be
a list, when GRPC itself types them as Sequence. With this change, we're
making the codepaths using interceptors more robust by explicitly turning them
into lists before manipulating them.

* Add a changelog entry

* .

* Run ruff

* Simplify
2025-05-23 07:35:46 +00:00
Christoph Heger 0db4d0bb8f
Replaced SpanAttributes with opentelemetry.semconv._incubating.attributes.db_attributes in tests. (#3532) 2025-05-22 16:07:21 +02:00
Emídio Neto 71bfc9550e
Update RELEASING.md (#3522) 2025-05-21 12:18:25 +00:00
Hector Hernandez 38f7413836
Update metric support table to include opentelemetry-instrumentation-aiohttp-server (#3514)
* opentelemetry-instrumentation-aiohttp-server metric support update

* Update

* Lint

* Update instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/package.py

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

* tox generate

* lint

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-21 09:56:11 +02:00
Adrian Garcia Badaracco 4d6893e8fa
fastapi: fix wrapping of middlewares (#3012)
* fastapi: fix wrapping of middlewares

* fix import, super

* add test

* changelog

* lint

* lint

* fix

* ci

* fix wip

* fix

* fix

* lint

* lint

* Exit?

* Update test_fastapi_instrumentation.py

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

* remove break

* fix

* remove dunders

* add test

* lint

* add endpoint to class

* fmt

* pr feedback

* move type ignores

* fix sphinx?

* Update CHANGELOG.md

* update fastapi versions

* fix?

* generate

* stop passing on user-supplied error handler

This prevents potential side effects, such as logging, to be executed
more than once per request handler exception.

* fix ci

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

* fix ruff

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

* remove unused funcs

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

* fix lint,ruff

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

* fix changelog

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

* add changelog note

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

* fix conflicts with main

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>
Co-authored-by: Alexander Dorn <ad@not.one>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-20 11:00:56 -03:00
Michael Safyan dbdff31220
feat(google-genai): add instrumentation to supplied tool call functions (#3446)
* Begin work to instrument tool calls.

* Add tests as well as the ability to record function details in span attributes.

* Add tests for the tool call wrapper utility.

* Update the changelog.

* Reformat with ruff.

* Switch to dictionary comprehension per lint output.

* Address generic names foo, bar flagged by lint.

* Reformat with ruff.

* Update to record function details only on the span.

* Reformat with ruff.

* Fix lint issue with refactoring improvement.

* Reformat with ruff.

* Improve attribute handling and align with 'execute_tool' span spec.

* Pass through the extra span arguments.

* Fix lint issues.

* Reformat with ruff.

* Update instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/tool_call_wrapper.py

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-05-19 18:08:20 +00:00
Riccardo Magliocchetti ef2b5468d5
Fix ruff (#3515) 2025-05-19 09:59:28 -03:00
Prajna Paramita Biswal f21182890a
requests: migrate from SpanAttributes (#3493)
* ref: migrate from SpanAttributes

* B
reverted to SpanAttributes for the SCHEMA_URL

* replace SpanAttributes.SCHEMA_URL

* sort imports

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-19 08:26:42 +00:00
Shubhendra Kushwaha ec731581af
refactor(fastapi): replace uses of `SpanAttributes` with `opentelemetry.semconv.attributes` (#3491)
* refactor(fastapi): migrate HTTP_ROUTE from SpanAttributes to new semantic conventions

Replaced usage of `SpanAttributes.HTTP_ROUTE` with `opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE`
as part of the migration away from `SpanAttributes`.

Refs: #3475

* refactor(fastapi): refactor tests

* refactor(fastapi): remove duplicated import

* sort imports

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-19 08:15:49 +00:00
Tamara Dancheva ccdf522626
Refactor asyncpg : replace uses of SpanAttributes with opentelemetry.semconv.attributes (#3505)
* Replace span in asyncpg

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

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

* refactor

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-15 19:07:54 +00:00
Almudena Sanz 9e1284687a
replace SpanAttributes by semconv attributes (#3503)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-15 18:54:05 +00:00
Caterina Andreu 1034b746af
Refactor: replace use of SpanAttributes (#3504) 2025-05-15 18:15:44 +00:00
Caterina Andreu 3efd161cb6
Refactor: replace use of SpanAttributes (#3502)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-15 17:58:37 +00:00
Almudena Sanz 99049a9652
replace SpanAttributes by semconv attributes (#3501)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-15 17:21:16 +00:00
Srdjan Lulic 4b9b949dde
Use semantic convention attribute for cloud region for botocore API calls (#3474)
* Update botocore instrumentation to use semantic convention attribute for cloud region

* Update changelog

* Move cloud region attribute to the breaking changes in the changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-15 16:41:52 +00:00
Riccardo Magliocchetti dc37067b93
RELEASING: update after label automation in workflows (#3488) 2025-05-15 16:31:22 +00:00
Srdjan Lulic 517257cbef
Fix flaky availability checks in docker-tests by using exponential backoff in the retry mechanism (#3499) 2025-05-15 18:08:38 +02:00
OpenTelemetry Bot 4a1e0ce941
Update version to 1.34.0.dev/0.55b0.dev (#3484) 2025-05-09 17:10:08 +02:00
Emídio Neto 9bc7764139
requests: support explicit_bucket_boundaries_advisory in duration metrics (#3464)
* requests: add explicit_bucket_boundaries_advisory support for duration metrics

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

* requests duration histogram stable semconv

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

* fix examples

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

* add changelog

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

* rename buckets variable

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-05-09 13:41:37 +00:00
Riccardo Magliocchetti abafc2131f
opentelemetry-exporter-prometheus-remote-write: workaround build failure with PyPy 3.8 (#3480)
Find a version that has a wheel for PyPy 3.8 skipping the failing test
while we bump the baseline to 3.9.
2025-05-09 10:36:11 -03:00
Oleg 2c0033f842
Add redis client only instrumentation (#3143)
* Rough draft of the contribution

* Add connection instrumentation based on the existing pattern.

add a helper function assert_span_count to simplify tests
add unit tests for pipeline hooks

* fix tests to use fake redis

* replace the redis version checks with defines

* Adjust comment and fix one test

* Update documentation with the client method

* Update the changelog

* Update the HTTPX readme to point to proper class method

* Add back the assert_span_count method

* Move the changelog update to the unreleased section

* Remove extra whitespace in the Changelog

* Fix linter complaints

* Remove hasattr assert

* Move the Changelog to Unreleased

* Review comments. Move types to types.py, move some functions to util.py. Tested and verified docs.

* Fix type compatibility

* fix typing and lint

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2025-05-09 09:13:46 +00:00
Andre Murbach Maidl cc7169cf2c
Improve aiopg instrumentation examples (#3468) 2025-05-07 12:43:03 +00:00
Andre Murbach Maidl 45797ec3a1
Improve aiokafka instrumentation examples (#3466) 2025-05-07 09:46:13 +00:00
Andre Murbach Maidl 5c76d04a35
Improve pymssql instrumentation examples (#3473) 2025-05-07 09:37:50 +00:00
Andre Murbach Maidl 9d41f9bf10
Improve mysqlclient instrumentation examples (#3470)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-05-07 09:14:03 +00:00
Andre Murbach Maidl 02dc87ef73
Improve pymysql instrumentation examples (#3472) 2025-05-07 10:52:35 +02:00
Srdjan Lulic e6869cdc75
Capture server attributes for botocore API calls (#3448)
* Capture server attributes for botocore API calls

* fix: use typing.Dict for 3.8 compatibility and resolve failing tests

* Update changelog

* Add server and port assertions for Bedrock API calls

* Add server address and port to Bedrock metric attributes

* Add license header and deferred type hint evaluation in utils.py

* Refactor metric attributes creation and add linter suppression (too-many-lines) for bedrock.py

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-30 14:29:12 +00:00
Emmanuel Ferdman dec311ff0e
Resolve datetime deprecation warnings (#3433)
* Resolve datetime deprecation warnings

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>

* Resolve datetime deprecation warnings

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>

---------

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-30 14:02:51 +00:00
OpenTelemetry Bot da661f6547
Copy changelog updates from package-release/opentelemetry-instrumentation-google-genai/v0.2bx (#3453) 2025-04-29 11:35:15 +02:00
OpenTelemetry Bot afc0d5531d
Update opentelemetry-instrumentation-google-genai version to v0.3b0 (#3443)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-28 15:19:36 +00:00
Emídio Neto 8a83770d7b
fix sha-automation (#3445)
* fix sha-automation

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

* use default github_token instead

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

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-04-28 15:55:03 +02:00
Joe McGinley 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
Emídio Neto 7f347e54df
infra: Automate SHA procedure during releases (#3424) 2025-04-24 09:31:08 -08:00
Michael Safyan 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
Kevin Rauwolf c54292fa08
Check for None result in gRPC (#3380) (#3381) 2025-04-21 07:41:14 -08:00
Emídio Neto 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
Eric Zhang 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
Emídio Neto 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
Emídio Neto c47e341ab8
Update CHANGELOG.md (#3430) 2025-04-17 15:36:45 +02:00
Emídio Neto 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
Michael Safyan 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
Rahul Kumar 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
Allen Kim 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
Emídio Neto 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
Andre Murbach Maidl 7562ff08f3
Improve tornado instrumentation example (#3410)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-04-14 14:56:53 +00:00
Riccardo Magliocchetti 4b832859cc
test-requirements: Bump jinja2 to 3.1.6 (#3420)
To please dependabot
2025-04-11 18:01:16 +02:00
OpenTelemetry Bot 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
fcfangcc 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
Andre Murbach Maidl 04f9e8dd7f
Improve starlette instrumentation example (#3409) 2025-04-10 11:57:07 +02:00
RJ Duffner 6d5a5149d0
Make auto instrumentation use the same dependency resolver as manual instrumentation does (#3202) 2025-04-08 15:11:09 +02:00
Andre Murbach Maidl 6bde73ce34
Improve pika instrumentation examples (#3390) 2025-04-02 14:17:52 +00:00
Andre Murbach Maidl 3a585b4b58
Improve httpx instrumentation examples (#3387) 2025-04-02 10:40:39 +00:00
Andre Murbach Maidl 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
Andre Murbach Maidl 5a2cfb3d65
Improve sqlalchemy instrumentation example (#3396) 2025-04-02 10:17:32 +00:00
Andre Murbach Maidl fdcd80d89f
Improve remoulade instrumentation example (#3391) 2025-04-02 09:58:35 +00:00
Riccardo Magliocchetti 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
OpenTelemetry Bot 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
Jason Anderson 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
Riccardo Magliocchetti 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
Andre Murbach Maidl 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
Riccardo Magliocchetti 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
Emídio Neto 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
Aaron Abbott 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
Joe McGinley 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
Bharat Arya 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
jinjia 139d787168
fix: opentelemetry-instrumentation-openai-v2 version in example (#3350) 2025-03-26 08:22:12 +00:00
Googleplex 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
Andre Murbach Maidl 76e614fac4
Improve botocore instrumentation examples (#3348) 2025-03-21 17:05:56 +00:00
Andre Murbach Maidl 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
Andre Murbach Maidl 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
Andre Murbach Maidl 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
Andre Murbach Maidl 3c60b62ad1
Improve falcon instrumentation examples (#3370) 2025-03-21 13:53:54 +00:00
Andre Murbach Maidl 8d14f0bb2a
Improve flask instrumentation example (#3371) 2025-03-21 13:37:30 +00:00
Andre Murbach Maidl a5474c3b29
Improve fastapi instrumentation example (#3372) 2025-03-20 16:02:36 +00:00
Michael Safyan 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
Riccardo Magliocchetti 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
Selcuk Ayguney 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
Leighton Chen f96d14cc62
update (#3363) 2025-03-13 09:35:08 +01:00
OpenTelemetry Bot 6189be647c
Update version to 1.32.0.dev/0.53b0.dev (#3359) 2025-03-12 12:07:49 -08:00
Andre Murbach Maidl 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
Emídio Neto db52193b3c
bump pyright (#3355)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2025-03-11 21:11:54 +00:00
Emídio Neto 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
Andre Murbach Maidl 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
Joe McGinley 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
Andre Murbach Maidl fde1ef84c7
Add instrumentation example to aiohttp-server (#3311) 2025-03-06 08:41:58 -08:00
Aaron Abbott 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
Andre Murbach Maidl 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
Riccardo Magliocchetti 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
Emídio Neto 3dd42960e0
Change affiliation for emdneto (#3343) 2025-03-06 13:05:15 +00:00
Riccardo Magliocchetti 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
dependabot[bot] 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
Riccardo Magliocchetti 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
Emídio Neto 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
Andre Murbach Maidl 2371adf3f8
Improve requests instrumentation example (#3316) 2025-03-05 23:23:09 -08:00
Emídio Neto 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
OpenTelemetry Bot a01564cf08
Update opentelemetry-instrumentation-google-genai version to v0.2b0 (#3334) 2025-03-05 14:28:54 -05:00
Aaron Abbott 9e4de00420
Small fixes for google-genai before releasing (#3330) 2025-03-05 10:40:00 -05:00
Riccardo Magliocchetti 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
Michael Safyan 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 567adc62a7.

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
Aaron Abbott 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
Andre Murbach Maidl f98f5688ae
Improve pymongo instrumentation example (#3315) 2025-03-03 10:17:02 +01:00
OpenTelemetry Bot 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
Aaron Abbott 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
Andre Murbach Maidl e0189e25dc
Improves aiohttp_client code snippet (#3306)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2025-02-28 14:10:25 +00:00
Riccardo Magliocchetti 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
Michael Safyan 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 567adc62a7.

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
Guangya Liu 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
Aaron Abbott b76119bb8f
VertexAI fix RST title underline (#3292) 2025-02-24 13:07:27 -05:00
OpenTelemetry Bot 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
Aaron Abbott dc01beda66
Add `run-name` with package name to single-package release workflows (#3287) 2025-02-24 15:48:36 +00:00
Riccardo Magliocchetti 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
Riccardo Magliocchetti 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
Riccardo Magliocchetti 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
Aaron Abbott f8bb30ef67
Updating workflows and RELEASING.md to allow vertexai individual release (#3284) 2025-02-21 17:12:14 -03:00
Emídio Neto 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
Aaron Abbott 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
Riccardo Magliocchetti e4a5b54135
scripts/generate_instrumentation_bootstrap: don't force genai instrumentations versions (#3278)
* scripts/generate_instrumentation_bootstrap: don't force genai instrumentations versions

Since genai instrumentations are released on their own we cannot have a
fixed required version on this side.
While at it add vertexai to the list of excluded packages since:
- it has not been released yet
- the name is already claimed by openllmetry

* Regenerate bootstrap_gen

* Please spellcheck

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2025-02-21 09:55:10 +00:00
Riccardo Magliocchetti 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
Emídio Neto 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
Aaron Abbott 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
Marcelo Trylesinski 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
Riccardo Magliocchetti 8644630e7f
opentelemetry-instrumentation-system-metrics: add support for psutil 7 (#3277) 2025-02-20 15:33:00 +01:00
OpenTelemetry Bot 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
dependabot[bot] 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
Michael Safyan 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
Guspan Tanadi 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
Riccardo Magliocchetti 789bf866e3
botocore: handle system messages events (#3266)
* botocore: handle system event messages

* Add CHANGELOG

* Please pylint
2025-02-14 10:17:08 +00:00
Stephan Klein 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
Marcelo Trylesinski 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
Riccardo Magliocchetti 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
Emídio Neto 34368612f4
Update .readthedocs.yml (#3264) 2025-02-12 14:54:01 +01:00
dependabot[bot] 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
Michael Schuett 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
Aaron Abbott 6e61ff0c32
VertexAI stop serializing unset fields into event (#3236) 2025-02-10 15:36:23 -05:00
Liudmila Molkova 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
Aaron Abbott 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
Maciej Nachtygal 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
XlKsyt d7bc137c60
openai: fix broken link (#3248) 2025-02-07 11:10:00 +00:00
Liudmila Molkova 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
Anuraag (Rag) Agrawal 6b3a11beb2
Render strings in bedrock test cassettes for readability (#3243) 2025-02-06 10:06:05 +01:00
Emídio Neto 9d8a6c6420
infra: fix workflows (#3240) 2025-02-04 13:24:34 -08:00
OpenTelemetry Bot 85e21a9e22
Update version to 1.31.0.dev/0.52b0.dev (#3233) 2025-02-04 12:55:11 -08:00
Leighton Chen d18c5fe19c
add vertexai to eachdist (#3230) 2025-02-03 13:01:37 -08:00
Tammy Baylis 65a2713d9f
Add mysql-connector instrumentor support for sqlcommenting (#3163) 2025-01-30 09:43:17 -08:00
Aaron Abbott 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
Riccardo Magliocchetti 7af1918b89
botocore: remove amazon copyright from bedrock_utils (#3215)
These code has been written from scratch
2025-01-28 20:22:56 +00:00
Riccardo Magliocchetti 44754e2a50
botocore: handle exceptions when consuming EventStream in bedrock extension (#3211) 2025-01-28 19:55:40 +00:00
Aaron Abbott 731054f736
Add server attributes to Vertex AI spans (#3208) 2025-01-28 16:46:13 +00:00
Emídio Neto 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
Riccardo Magliocchetti eabab7d0ad
Fix changelog (#3213) 2025-01-28 14:31:11 +01:00
Riccardo Magliocchetti 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
guillaumep 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
Riccardo Magliocchetti 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
Riccardo Magliocchetti 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
Aaron Abbott 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
Josh Owen 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
Riccardo Magliocchetti 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
OpenTelemetry Bot 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
Riccardo Magliocchetti 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
OpenTelemetry Bot 86a7f6bab3
Update opentelemetry-instrumentation-openai-v2 version to v2.2b0 (#3194) 2025-01-17 20:12:12 -08:00
Emídio Neto 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
Aaron Abbott 9d9353d4c6
Run pyright on Vertex AI instrumentation (#3184) 2025-01-16 14:25:35 -05:00
Drew Robbins a716949d1c
Add metrics to the Python OpenAI instrumentation (#3180) 2025-01-15 14:24:35 -08:00
Marcelo Trylesinski 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
Marcelo Trylesinski 52871b82b6
Add type hints to HTTPX (#3098) 2025-01-14 09:27:35 -08:00
Marcelo Trylesinski 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
Josh Soref c59b514cda
Fix component owner workflow permissions (#3165) 2025-01-13 15:42:32 -08:00
Marcelo Trylesinski 5219242eaf
Support PEP 561 to `opentelemetry-instrumentation-wsgi` (#3129) 2025-01-13 13:32:16 -08:00
Filip Nikolovski b7e7d0cbe5
Implement new HTTP semantic convention opt-in for Falcon (#2790) 2025-01-13 11:49:22 -08:00
Marcelo Trylesinski 406707b2bd
Add type checker (#3116) 2025-01-13 09:20:33 -08:00
Tammy Baylis 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
Marcelo Trylesinski 29ef6a9455
Add type hints to dbapi (#3068) 2025-01-10 10:03:09 -08:00
Marcelo Trylesinski 3ebdb6344b
Support PEP 561 to `opentelemetry-instrumentation-pymongo` (#3136) 2025-01-10 09:20:28 -08:00
Marcelo Trylesinski a606fab849
Support PEP 561 to `opentelemetry-instrumentation-requests` (#3135) 2025-01-10 09:00:10 -08:00
Marcelo Trylesinski 0ad779a5b3
Support PEP 561 to `opentelemetry-instrumentation-jinja2` (#3137) 2025-01-09 17:42:12 -08:00
Will Li 962a3aecdb
fix #991 audit asyncpg instrumentation with nooptracerprovider (#3144) 2025-01-09 14:51:23 -08:00
Guspan Tanadi 41e670aeee
docs(README): semantic convention migration links (#3160) 2025-01-09 13:58:53 -08:00
Marcelo Trylesinski 9af3136e7f
Support PEP 561 to `opentelemetry-util-http` (#3127) 2025-01-09 13:21:19 -08:00
Tammy Baylis cf6d45e96c
DB-API: db.statement inclusion of sqlcomment as opt-in (#3115) 2025-01-09 13:08:46 -08:00
Tammy Baylis 26bcc9347b
SQLAlchemy: db.statement inclusion of sqlcomment as opt-in (#3112) 2025-01-09 12:56:14 -08:00
Riccardo Magliocchetti 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
Tammy Baylis 147e3f754e
Add check before iterating over dist.requires at load_instrumentor (#3168)
* Add check before iterate over dist.requires

* Changelog

* Add test
2025-01-08 10:02:55 +01:00
Marcelo Trylesinski 3d5935f4f6
docs: add missing import to aws-lambda (#3154) 2025-01-02 12:18:07 -08:00
GonzaloGuasch 95f14cd8df
wsgi: always record span status code to have it available in metrics (#3148) 2025-01-02 11:58:17 -08:00
Marcelo Trylesinski e5eb524e89
Improve type hints in `opentelemetry.instrumentation.utils` (#3128) 2025-01-02 11:44:58 -08:00
Marcelo Trylesinski 3e394a4814
Support PEP 561 to `opentelemetry-instrumentation-system-metrics` (#3132) 2025-01-02 11:30:41 -08:00
Marcelo Trylesinski 16c041e22b
Support PEP 561 to `opentelemetry-instrumentation-sqlite3` (#3133) 2025-01-02 11:15:01 -08:00
Emídio Neto 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
Cyrille Le Clerc c084ca8fa5
Update README.rst - Fix Markdown (#3156)
Fix broken Markdown.

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-31 16:31:33 +01:00
Riccardo Magliocchetti 8db1479e0d
RELEASING: Document what package prepare release workflows will create (#3153)
While at it fix formatting
2024-12-30 13:13:07 +00:00
Emídio Neto 72dc1cf1f6
prometheus-remote-write: bump cramjam to 2.8.4 in test-requirements (#3157)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-12-30 09:26:54 +01:00
Emídio Neto 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
OpenTelemetry Bot d116ae39d6
Update opentelemetry-sdk-extension-aws version to v2.2.0 (#3149) 2024-12-24 15:59:31 +01:00
Emídio Neto 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
Emídio Neto 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
Aaron Abbott 5fd648eac4
Remove unnecessary configuration of logs exporter in Gen AI samples (#3141)
It is no longer necessary since we now set up the logging pipeline by
default with OTLP exporter.
2024-12-23 19:29:50 +00:00
Emídio Neto 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
YR Chen 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
Guangya Liu 59894979ef
[chore] Removed $ from command for contribution guidance (#3114)
The copy in markdown file always copy the $ as well when copying the command,
I need to remove the $ manually each time.

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-23 14:02:02 +00:00
Emídio Neto 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
Emídio Neto 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
Riccardo Magliocchetti 7eead8f1ae
opentelemetry-sdk-extension-aws: make ec2 resource detector silent when loaded outside AWS (#3120)
* opentelemetry-sdk-extension-aws: make ec2 resource detector silent when loaded outside AWS

Assume that if we fail to get the token quickly we are not on AWS.
2024-12-23 09:43:09 +00:00
Aaron Abbott 72576f65e0
Vertex AI instrumentation boilerplate (#3123)
* Vertex AI boilerplate copied from openai-v2

* tox.ini boilerplate

* tox -e generate,generate-workflows
2024-12-21 23:45:53 +00:00
Beijie Zhang 1092344918
Add docstring for instrument_connection() and tests for database drivers (#3108) 2024-12-20 12:24:46 -08:00
Andrea Galbusera 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
Emídio Neto 1ddba1b518
contributing: add guidance on how to update package versions support (#3090)
* contributing: add guidance for update package versions support

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

* update the guide

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

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md to add docs instructions

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-18 18:05:29 +01:00
RJ Duffner 52ff7bdd4b
feat: Update opentelemetry-instrumentation-confluent-kafka to support confluent-kafka <=2.7.0 (#3100) 2024-12-17 12:33:39 -08:00
Marcelo Trylesinski 6fcaa0a104
Add type hints to Redis (#3110) 2024-12-17 10:40:40 -08:00
Emídio Neto cc62d1f05e
prepare semconv utilities to support database stability opt-in (#3111) 2024-12-17 09:58:04 -08:00
Marcelo Trylesinski d155540038
httpx: update type hints to `RequestInfo`/`ResponseInfo` (#3105) 2024-12-17 09:43:22 -08:00
Adrian Cole f8b0f726ce
opentelemetry-instrumentation-openai-v2: updates versions in examples (#3102) 2024-12-17 09:23:08 -08:00
Emídio Neto 59ecd4d608
infra: improve tox for local development (#2999)
* move pip install from command to deps

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

* add docker-test-requirements.txt

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

* fix celery and docs

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

* fix

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

* fix tox.ini

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

* update docs

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

* Update tox.ini

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-12-17 14:24:50 +01:00
Riccardo Magliocchetti 770003dd17
opentelemetry-sdk-extension-aws: make ecs and beanstalk resource detector silent when loaded outside AWS (#3076)
* opentelemetry-sdk-extension-aws: make ecs detector less chatty

Don't print warnings if we are not running inside an ecs instance so we can load the
resource detector more generally and avoid warnings in stderr.

* opentelemetry-sdk-extension-aws: make beanstalk detector less chatty

Don't print warnings if we are not running inside beanstalk so we can load the
resource detector more generally and avoid warnings in stderr.

* Add changelog
2024-12-16 10:28:18 +00:00
Riccardo Magliocchetti 38f0e33641
opentelemetry-sdk-extension-aws: make eks detector less chatty (#3074)
* opentelemetry-sdk-extension-aws: make eks detector less chatty

Don't print warnings if we are not running inside an eks instance so we can load the
resource detector more generally and avoid warnings in stderr.

* Update CHANGELOG

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-13 15:39:07 +00:00
Marcelo Trylesinski 37e05aff86
Move starlette's py.typed to the right place (#3103) 2024-12-13 14:53:17 +01:00
OpenTelemetry Bot 490580d6f3
Update version to 1.30.0.dev/0.51b0.dev (#3092) 2024-12-12 11:17:53 +00:00
Marcelo Trylesinski d2a51b95e5
docs: move `AwsLambdaInstrumentor().instrument()` to after the lambda function (#3085)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-11 16:02:37 +01:00
Diego Amaral eb03dac1f0
NoOpTracerProvider test case for botocore instrumentation (#3091)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-11 13:35:50 +00:00
Tammy Baylis 830231092d
Update sqlite3 instrumentor doc about explicit cursors (#3088)
* Update sqlite3 instrumentor doc about explicit cursors

* Changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-11 11:59:21 +00:00
Marcelo Trylesinski e32aac7b18
Improve SQLite3 example (#3083)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-11 11:25:01 +00:00
Marcelo Trylesinski 7804e0a4e8
Add type hints to BaseInstrumentor (#3084) 2024-12-11 10:37:51 +01:00
Riccardo Magliocchetti ecf5529f99
opentelemetry-instrumentation-django: bump to 4.2.17 in test requirements (#3077)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-09 17:08:17 +00:00
Riccardo Magliocchetti c530f0d98f
instrumentation: Bump Werkzeug to 3.0.6 (#3078)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-09 14:46:44 +01:00
Riccardo Magliocchetti eb394c0b21
opentelemetry-instrumentation-tornado: bump tornado in test requirements (#3079) 2024-12-09 14:31:31 +01:00
Adrian Cole 6134d5a2f9
opentelemetry-instrumentation-openai-v2: coerce openai response_format to semconv format (#3073)
* opentelemetry-instrumentation-openai-v2: coerce openai response_format to semconv format

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>

* changelog

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>

---------

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
2024-12-09 10:46:13 +01:00
Leonid Bugaev 6c92f387aa
Fix doc formatting issues (#3062)
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-05 13:53:21 +01:00
Marcelo Trylesinski f393546d4a
Add type hints to SQLite3 (#3057)
* Add type hints to SQLite3

* Apply suggestions from code review

* Update instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/package.py

* This is a type alias, pylint is dumb

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2024-12-04 14:14:12 +00:00
Riccardo Magliocchetti 9cf26836bd
CONTRIBUTING: notes abount adding doc for new instrumentation (#3064)
* CONTRIBUTING: notes abount adding doc for new instrumentation

While at it revise the versioning paragraph to take into account the
openai instrumentation.

* Reword doc paragraph

* Update CONTRIBUTING.md

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

* Add autodoc template

* Add notes about tox

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-04 08:27:56 +00:00
Pete Hodgson 76170313f1
Fix instrumentation of SQLAlchemy when using sqlalchemy.engine_from_config (#2816)
* wrap sqlalchemy.engine.create.create_engine

sqlalchemy.engine_from_config directly calls create_engine imported from that path; if we don't
wrap that copy of the `create_engine` call then engines created via engine_from_config are not
instrumented.

* add changelog entry

* Update CHANGELOG.md

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

* Update instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py

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

* make some monkey-patching conditional on the version of SQLAlchemy

* lint

* fix changelog

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

* Update CHANGELOG.md

---------

Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Emídio Neto <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>
Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-04 10:13:07 +02:00
Emídio Neto 9e83e25441
test two requirements files for docs and rtd (#3039) 2024-12-03 10:03:23 -08:00
Rytis Bagdziunas b6541f0bad
Remove references to disposed SQLAlchemy engines from instrumentation singleton (#3053)
* Remove references to SQLAlchemy engines which are disposed of

EngineTracer in SQLAlchemy keeps weak references to a traced engine forever which
can cause a noticeable memory leak if engines are constantly getting creating.

* Updated changelog

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-03 09:31:08 +00:00
Emídio Neto 668cb75f24
docs: add missing autodoc for click and aiohttp-server (#3060)
* add missing docs for click and aiohttp-server

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

* fix click readme

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

* add nitpick

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>
2024-12-03 09:19:43 +00:00
Marcelo Trylesinski 0da62aa532
Add type hints to Starlette instrumentation (#3045)
* Add type hints to Starlette instrumentation

* format

* Add changelog

* Add changelog

* Remove pyright ignore

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-12-02 22:28:45 -05:00
Liudmila Molkova 142b86c1bf
OpenAI instrumentation docs fixes (#2988)
* Add openai docs config and improve readme

* up

* Add manual sample, add no-content tests

* update headers

* lint

* use grpc endpoint in openai samples, add extra env vars to readme

* move distro fix to another PR

* nits

* Ignore examples for pylint

* Update .pylintrc

* ignroe lint for example

* Fix README docs

* Update openai.rst

* Update conf.py

* Update docs-requirements.txt

* docs

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-12-02 10:23:11 +01:00
Emídio Neto 8656a06f88
try update misc workflows to py311 (#3055)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-11-28 17:07:52 +00:00
Riccardo Magliocchetti af8d0930ca
opentelemetry-instrumentation-openai-v2: pin httpx dependency (#3056)
As 0.28.0 broke compat with old openai client.
2024-11-28 13:40:15 -03:00
Riccardo Magliocchetti d330ab3dd0
Add click instrumentation (#2994)
* Add instrumentation for click based CLI apps

Co-authored-by: Anuraag (Rag) Agrawal <anuraaga@gmail.com>

* Add tox

* Add Changelog

* Silence pylint

* Update tox.ini

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

* Update instrumentation/opentelemetry-instrumentation-click/pyproject.toml

* Add baseline version

* Adhere to new cli span semconv

* Update workflows

---------

Co-authored-by: Anuraag (Rag) Agrawal <anuraaga@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-11-27 08:38:38 +00:00
Marcelo Trylesinski 16ebf2519b
starlette: Replace `_meter_provider` by `meter_provider` on `_instrument` (#3048)
* starlette: Replace `_meter_provider` by `meter_provider` on `_instrument`

* Add PR on the changelog

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-11-26 21:46:47 +00:00
Emídio Neto 97d1514b65
fix missing contrib_repo_sha in workflow (#3049)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
2024-11-26 15:03:42 +01:00
Emídio Neto 41bd34f6e1
infra: configure generate-workflows to generate core-contrib-tests (#3035)
* test call workflow

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

* fix name

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>
2024-11-26 12:16:45 +00:00
Liudmila Molkova 1737ee6940
Use OTLP log exporter by default in otel-distro (#3042)
* Use OTLP log exporter by default in otel-distro

* changelog

* sort imports
2024-11-26 09:43:11 +01:00
Tammy Baylis 5c5fc732fb
Replace assertEqualSpanInstrumentationInfo with assertEqualSpanInstrumentationScope (#3037)
* Replace assertInstInfo with assertInstScope

* Update Changelog

* Fix order of other changelog entries
2024-11-22 09:32:04 +01:00
Riccardo Magliocchetti d9e14487b2
opentelemetry-instrumentation-system-metrics: fix typo in metrics configs (#3025) 2024-11-21 14:12:51 -08:00
Riccardo Magliocchetti 116f98df72
opentelemetry-instrumentation-httpx: drop unused private classes (#3036) 2024-11-21 08:52:22 -08:00
Tammy Baylis 7b1554bddc
Add PyMySQL instrumentor support for sqlcommenting (#2942)
* WIP

* Add _DB_DRIVER_ALIASES

* Add mysql_client_version to sqlcomment

* lint

* Fix existing tests

* lint test

* Add PyMySQL dbapi commenter case

* Add test

* Add test

* Add test

* Add tests

* Changelog

* calculate_commenter_data at init of DatabaseApiIntegration

* try-except if NoneType module

* Add pymysql sqlcomment support

* Add unit tests

* Update docstring

* Changelog

* pymysql instrument_connection specifies connect_module

* lint

* Add tests

* Fix doc

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-11-21 16:21:12 +00:00
Tammy Baylis beff723389
Add mysqlclient instrumentor support for sqlcommenting (#2941)
* WIP

* Add _DB_DRIVER_ALIASES

* Add mysql_client_version to sqlcomment

* lint

* Fix existing tests

* lint test

* Add PyMySQL dbapi commenter case

* Add test

* Add test

* Add test

* Add tests

* Changelog

* calculate_commenter_data at init of DatabaseApiIntegration

* Add mysqlclient sqlcomment support

* Fix typo

* try-except if NoneType module

* Add unit test

* CHangelog

* mysqlclient instrument_connection with connect_module

* add tests

* more tests

* more tests 2

* lint

* Redesign tests

* Rm unnecessary mocks
2024-11-21 10:37:08 -05:00
Tammy Baylis 4e992dd60a
DB-API instrument_connection accepts optional connect_module (#3027)
* DbApi instrument_connection accepts optional connect_module

* Changelog

* Add test

* Adjust tests
2024-11-20 14:44:56 -05:00
Adrian Cole d0cbf8e1a5
Correct formatting of CHANGELOG (#3029)
Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-11-20 12:54:06 +00:00
Leighton Chen 0032e68161
Update RELEASING.md (#3001) 2024-11-20 10:01:12 +01:00
Adrian Cole ae13079df8
Add OpenAI example (#3006) 2024-11-19 22:48:27 -08:00
Emídio Neto 19a59e4be7
fix(httpx): check if mount transport is None before wrap (#3022) 2024-11-19 11:40:06 -08:00
Tammy Baylis 1c820ea96e
SQLAlchemy instrumentor populates span after sqlcomment creation, not before (#2937) 2024-11-19 09:30:26 -08:00
Tammy Baylis 53b87145b3
DB-API instrumentor populates span after sqlcomment creation, not before (#2935) 2024-11-19 09:13:31 -08:00
Anton Pirker a29ad8a6a3
Fix link to confluent_kafka docs (#3024) 2024-11-19 09:26:10 +01:00
Aaron Abbott 23f67eb77b
Cherry pick eachdist.py changes to main from release/v1.28.x-0.49bx branch (#3018)
* Fix prepare patch release workflow (#3013)

* Fix eachdist.py patch release to respect "all" and "excluded" (#3016)
2024-11-18 12:29:35 -05:00
Riccardo Magliocchetti 803bb322ba
opentelemetry-instrumentation-httpx: make instrument_client a staticmethod again (#3003)
* opentelemetry-instrumentation-httpx: make instrument_client a staticmethod again

* ADd changelog

* Can be a classmethod

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-11-14 19:08:03 +01:00
Leighton Chen c32cc7a3e2
Remove updating CHANGELOG step in release workflow (#3000) 2024-11-14 09:52:32 -08:00
Ali Waleed a6e4a0ca43
Add Support for `Async` openai instrumentation (#2984) 2024-11-14 08:53:27 -08:00
Leighton Chen e3ba54b95c
Add openai instrumentation to opentelemetry-bootstrap (#2996) 2024-11-12 15:13:42 -08:00
Adrian Cole 89a0b28a09
opentelemetry-instrumentation-openai-v2: scrub cookie from tests (#2993) 2024-11-12 13:01:49 -08:00
Leighton Chen c28f7c978e
re-add testpypi publish step (#2991) 2024-11-12 09:18:09 -08:00
Liudmila Molkova b6a6f75834
publish to pypi (#2980) (#2987) 2024-11-11 11:02:20 -08:00
Tammy Baylis 66a6780721
Add generate-workflows usage to CONTRIBUTING (#2977) 2024-11-11 10:53:42 -08:00
Adrian Cole bf8e2814ea
opentelemetry-instrumentation-openai-v2: add codefromthecrypt and fix yaml fixture (#2989) 2024-11-11 08:12:26 -08:00
OpenTelemetry Bot 4606cf2c10
Copy changelog updates from package-release/opentelemetry-instrumentation-openai-v2/v2.0bx (#2982) 2024-11-07 17:03:39 -08:00
Guangya Liu 46b14662f8
adding gyliu513 as genai reviewer (#2972) 2024-11-07 16:07:33 -08:00
Emídio Neto 1d6968b672
fix: teach instrument version constraint for sqlalchemy (#2971) 2024-11-07 15:39:16 -08:00
Tammy Baylis 1d8286c08a
Update tests to work with SQLAlchemy 2 (#2976) 2024-11-07 15:18:05 -08:00
Emídio Neto ca4d5170d0
fix: remove opentelemetry-instrumentation-test package from bootstrap_gen (#2969) 2024-11-07 11:18:51 -08:00
Nir Gazit 4a5bf9bd7e
add nirga to GenAI component owners (#2962) 2024-11-07 10:59:17 -08:00
Liudmila Molkova 499548ebbb
Test packages that are released individually with lowest versions they support (#2961) 2024-11-07 10:47:19 -08:00
Riccardo Magliocchetti 77613da396
Drop selective enabled for windows and regenerate workflows (#2964) 2024-11-06 17:36:33 +01:00
OpenTelemetry Bot 226258e457
Update version to 1.29.0.dev/0.50b0.dev (#2954) 2024-11-05 14:22:03 -08:00
OpenTelemetry Bot 6c88f01f0c
Update opentelemetry-instrumentation-openai-v2 version to v2.1b0 (#2960) 2024-11-05 13:28:54 -08:00
Liudmila Molkova d341ef5062
prepare before preparing release (#2958) 2024-11-05 12:30:58 -08:00
Riccardo Magliocchetti acffef957d
opentelemetry-instrumentation: stick to latest semantic conventions package (#2952)
To match the instrumentations.

Will hopefully fix pip not able to handle the situation:

  opentelemetry-instrumentation 0.49b0 depends on opentelemetry-semantic-conventions>=0.48b0
  opentelemetry-instrumentation-dbapi 0.49b0 depends on opentelemetry-semantic-conventions==0.49b0
2024-11-05 14:20:03 +01:00
Riccardo Magliocchetti 8cfbca2293
opentelemetry-instrumentation-system-metrics: don't report open file descriptors on windows (#2946)
* opentelemetry-instrumentation-system-metrics: don't report files descriptors on windows

* Run manually added tox env tests on windows too

* Add jobs for botocore and system-metrics on windows

* Skip open file descriptor test on windows

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
2024-11-05 09:39:29 +01:00
Adrian Cole d6a59e4bdf
opentelemetry-instrumentation-openai-v2: format test data for readability (#2945)
* opentelemetry-instrumentation-openai-v2: format test data as YAML literal block scalar for readability

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>

* ruff

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>

* Update instrumentation/opentelemetry-instrumentation-openai-v2/tests/conftest.py

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

---------

Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-11-05 09:21:59 +01:00
Liudmila Molkova 155962b442
GenAI: Use common env var for content recording (#2947) 2024-11-04 12:27:42 -08:00
Leighton Chen 3109724f48
Add genai contributing guidance (#2944) 2024-11-04 06:18:11 -08:00
Liudmila Molkova 07c3324a3b
OpenAI - update semantic conventions to the latest version, write logs based events instead of span events (#2925) 2024-10-30 14:07:24 -07:00
Riccardo Magliocchetti 54c7ee80ab
exporter/prometheus_remote_write: sort labels before exporting (#2940) 2024-10-30 11:43:33 -07:00
Tammy Baylis a940fc4a65
Add DB-API instrumentor support for MySQL driver sqlcommenting (#2897) 2024-10-30 10:46:11 -07:00
Riccardo Magliocchetti f6b68d0c02
httpx: rewrite patching to use wrapt instead of subclassing client (#2909)
httpx: rewrote patching to use wrapt instead of subclassing client

Porting of httpx instrumentation to patch async transport methods instead of substituting the client. That is because the current approach will instrument httpx by instantianting another client with a custom transport class and this will race with code already subclassing. This one uses wrapt to patch the default httpx transport classes.

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-10-29 20:33:35 +00:00
Riccardo Magliocchetti 7cbe58691a
opentelemetry-instrumentation-celery: don't detach a None token (#2927) 2024-10-28 09:40:25 -07:00
Riccardo Magliocchetti 8582da5b8d
opentelemetry-instrumentation: don't fail if an instrumentor raises ImportError (#2923) 2024-10-25 12:25:51 -07:00
Mengyi Zhou (bjrara) 779ec9eb93
Fix unit in system metrics (#2922) 2024-10-25 12:00:37 -07:00
Sai Chander e49806ea35
Configurable Middleware Position for Django Instrumentation (#2912) 2024-10-24 13:46:25 -07:00
Riccardo Magliocchetti 39bd7fa79a
opentelemetry-instrumentation: add unwrapping from dotted paths strings (#2919) 2024-10-24 13:19:29 -07:00
Erle Carrara 5145a07fd1
Support functools.partial functions in AsyncioInstrumentor.trace_to_thread (#2911) 2024-10-24 13:07:20 -07:00
Riccardo Magliocchetti 5c566a0c37
opentelemetry-instrumentation: make it easier to use bootstrap with custom values (#2918) 2024-10-24 09:34:54 -07:00
Emídio Neto 0adc58b4bf
Introducing ruff as linter and formatter (basic setup) (#2921) 2024-10-23 10:54:14 -07:00
Riccardo Magliocchetti 9d06509bf5
Fixup changelog (#2924) 2024-10-23 09:32:06 -03:00
Karthik Kalyanaraman beed0aa395
Add Initial Support for Instrumenting OpenAI Python Library - Chat Completion Create (#2759) 2024-10-22 09:21:43 -07:00
Allen Kim cef28d6f24
Fix to allow topic to be passed via kwargs (#2901)
* Fix to allow topic to be imported from kwargs

* add changelog

* lint

* separate assert function
2024-10-22 10:22:07 +02:00
Riccardo Magliocchetti e4ece57a81
Remove pkg resources (#2871) 2024-10-19 06:49:08 -07:00
Emídio Neto d7d7e96ce5
fix: shellcheck and docker-tests in CI (#2905) 2024-10-15 12:38:03 -07:00
Liudmila Molkova 6a54106f5b
Automate per-package release for specific components (#2875) 2024-10-09 09:20:02 -07:00
Marcin Poźniak 6bb6d3896d
Add additional attributes for redis.search methods create_index, search (#2635) 2024-10-02 15:42:33 -07:00
Emídio Neto 65b703529b
Update CHANGELOG.md (#2888)
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-10-02 11:58:32 +02:00
Emídio Neto eccb05c808
tests: bump cryptography to 43.0.1 in test-requirements (#2889)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-09-30 15:50:07 -06:00
Dmitriy d52f42fb7f
feat(opentelemetry-instrumentation-aiokafka): wrap getone instead of anext, add tests (#2874)
* add tests

* add to CHANGELOG

* add tests for baggage

* wrap getone instead of __anext__

* split sync and async tests (fix review)

* add dimastbk to component_owners.yml for aiokafka

* Update CHANGELOG.md

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-09-26 13:00:31 +00:00
Anton Pirker f8bb28928c
Update test requirements for work with Python 3.13 (#2887)
* Added deb to make cassandra tests work with python 3.13

* Bumped cffi to work with Python 3.13

* Fixed some test-requirements for Python 3.13

* Updated typing_extensions everywhere

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-09-26 08:52:02 +02:00
Rocky Ken a084c2c7df
Add fallback decoding for asgi headers (#2837)
* Add latin-1 fallback decoding for asgi headers

* Add comment for ASGI encoding spec and change to unicode_escape

* add unit test for non-utf8 header decoding

* add changelog

* revert lint

* code review changes

* Fix changelog

* Add ASGIGetter test

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-09-25 17:19:20 +02:00
Riccardo Magliocchetti 3deb6b9db6
opentelemetry-instrumentation-flask: a bit more room on metrics tests (#2884) 2024-09-23 13:56:37 -07:00
heidi229 41b64539d0
update editable install link in readme.md (#2881) 2024-09-23 10:09:06 -07:00
Emídio Neto 6fcfbd67b8
tests: fix docker-tests mssql (#2878)
* try new image

* try new image with new pyodbc verrsion
2024-09-23 09:44:07 +02:00
Riccardo Magliocchetti 97c3664fd7
Fix public-symbols-check workflow generation (#2876)
Consider only pull request events when running  public-symbols-check.
2024-09-19 10:00:22 +02:00
Leighton Chen 08def3e40a
Update pyproject.toml (#2873)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-09-17 08:38:24 +00:00
Dmitriy 1a39ac80f8
feat: add opentelemetry-instrumentation-aiokafka (#2082) 2024-09-16 12:02:39 -07:00
BryanFauble bed13f5136
Add consistent import statement for URLLibInstrumentor (#2868)
* Add consistent import statement for URLLibInstrumentor

* Correct code in example

* One last correction to doc to create instance
2024-09-13 15:53:13 +02:00
Jeremy Voss d135f20c29
Fastapi auto tests (#2860)
* ep test passes

* cleaned ep test

* Corrected mock paths.

* with installed works

* tests pass

* Clean up

* Clean up

* lint

* lint
2024-09-12 09:36:59 +02:00
Jared Tan 6f1a17d8dd
fix grpc supported version (#2845) 2024-09-10 08:43:44 -07:00
Tobias Backer Dirks 02c956190d
feat: add ability to optionally disable internal HTTP send and receive spans (#2802) 2024-09-10 07:45:06 -07:00
Riccardo Magliocchetti 9cced9757a
CONTRIBUTING: add a note about instrumentation versioning and depdendencies (#2851) 2024-09-04 10:45:06 -07:00
kaushik95 f1d91097d8
973 opentelemetry instrumentation psycopg2 (#2840) 2024-09-04 09:39:17 -07:00
Diego Hurtado afb7f54b50
Remove ocelotl from component owners (#2848) 2024-09-04 07:06:58 -07:00
rama280290 6c5730f31a
Update test_jinja2.py (#2491)
Cross-site scripting (XSS) attacks can occur if untrusted input is not escaped. This applies to templates as well as code. The jinja2 templates may be vulnerable to XSS if the environment has autoescape set to False. Unfortunately, jinja2 sets autoescape to False by default. Explicitly setting autoescape to True when creating an Environment object will prevent this.

Signed-off-by: Rajendran, Ramasubramanian <Ramasubramanian.Rajendran@fmr.com>
2024-09-04 12:24:25 +00:00
Blueswen d6e667f3eb
Update README.rst (#2849)
The URL link is incorrect; it should be a repository in the open-telemetry account.
2024-09-04 13:55:00 +02:00
Emídio Neto 40c3363e9d
bump asgiref to 3.8.1 in test-requirements (#2841)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-09-03 13:28:53 -06:00
Karoline Pauls f5868df7f8
opentelemetry-instrumentation-asyncio: package name typo (#2844) 2024-09-02 17:06:57 +02:00
JianQiao 98958b6f1e
Fix description of http.server.duration and http.server.request.duration (#2817)
* fix httpserverduration and httpserverrequestduration

Signed-off-by: Steven Pan <jianqiao.pan@fmr.com>

* add change log

---------

Signed-off-by: Steven Pan <jianqiao.pan@fmr.com>
2024-08-30 10:42:33 +00:00
Emídio Neto f7878e7613
fix core repo sha in workflows (#2842) 2024-08-29 10:07:04 -07:00
OpenTelemetry Bot f8a4f1ebf8
Copy change log updates from release/v1.27.x-0.48bx (#2839) 2024-08-28 15:54:08 -07:00
OpenTelemetry Bot ee67ea8ba5
Update version to 1.28.0.dev/0.49b0.dev (#2828)
* Update version to 1.28.0.dev/0.49b0.dev

* Update core SHA

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-08-28 15:20:37 -06:00
Diego Hurtado 161acbb8ca
Skip generate-workflows when triggered by push (#2836)
Fixes #2835
2024-08-28 12:12:08 -06:00
Jack Gong b0129acbdf
fix ut in pypy (#2809) 2024-08-28 10:02:42 -07:00
Diego Hurtado 5a0540ba8b
Remove references to test.yml (#2830)
* Remove references to test.yml

Fixes #2829

* Update scripts/update_sha.py

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

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-08-27 18:08:00 +00:00
Leighton Chen 3ec1b9717c
Add new maintainers aabmass and xrmx (#2825)
Congratulations and welcome @aabmass and @xrmx as new Python maintainers! We greatly appreciate your help and expertise.

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-08-27 17:44:37 +00:00
Riccardo Magliocchetti 476f6e245a
bootstrap: don't strip \n for last item on listing (#2820) 2024-08-26 12:46:08 -07:00
Riccardo Magliocchetti 5558e78d8c
httpx: decouple tests from proxy related environment variables (#2822) 2024-08-26 12:24:53 -07:00
Riccardo Magliocchetti 830397ecbf
httpx: fix handling of async hooks (#2823) 2024-08-26 09:54:57 -07:00
Riccardo Magliocchetti 19f8e775ce
Prepare asgi tests to support newer asgiref version (#2778) 2024-08-26 09:38:07 -07:00
Leighton Chen bc4d2c5b75
Fix `http.host` and `net.peer.ip` new http semconv mapping (#2814) 2024-08-23 16:56:36 -07:00
Ben C fb75ac05d8
replaced broken link (#2815) 2024-08-23 12:15:29 -07:00
Mrugesh Master 1ad9d90308
Divided proc_cpu_percent by 100 to get value between 0 and 1 (#2812) 2024-08-21 15:24:46 -07:00
Emídio Neto dda369b724
bump webob to 1.8.8 in test requirements (#2804) 2024-08-19 08:39:17 -07:00
Jordan Gibbings 560fd04962
fix(tornado): ensure reading future.result() won't throw an exception in client.py _finish_tracing_callback (#2563) 2024-08-19 07:59:24 -07:00
B Ramshankar 4108d57e7a
fix for Audit and test opentelemetry-instrumentation-jinja2 #978 (#2799) 2024-08-16 14:27:24 -07:00
Diego Hurtado e7f647e91b
Add skip clause for Public API check (#2801)
Fixes #2800
2024-08-15 17:05:45 -06:00
shijiadong2022 af9e841742
Fix issue opentelemetry-instrumentation-asgi: do not set url.full attribute for server spans (#2735) 2024-08-14 10:26:39 -07:00
Emídio Neto 9c327eae00
bump aiohttp to 3.10.2 (#2796) 2024-08-13 13:48:46 -07:00
Emídio Neto f1f017fd15
opentelemetry-bootstrap: remove aws-lambda from default instrumentations (#2786) 2024-08-12 12:51:34 -07:00
Roberto Villarreal 6981035aec
Ensure async generators are awaited (#2792) 2024-08-12 09:14:43 -07:00
Emídio Neto f9dc90fedc
bump django version in test requirements (#2785) 2024-08-08 08:54:15 -07:00
Radoslav Kirilov c238af5442
fix: `fastapi` auto-instrumentation by removing `fastapi-slim` support (#2783) 2024-08-08 08:45:00 -07:00
Qiu Ge fc1c8f0f3f
Audit and test opentelemetry-instrumentation-fastapi NoOpTracerProvider (#2779) 2024-08-07 08:41:01 -07:00
Diego Hurtado 009bdbaef0
Remove instrumentations_1.yml (#2782)
Fixes #2781
2024-08-06 16:41:00 -06:00
Diego Hurtado f0d8cb39e9
Generate workflow files with a Jinja template (#2687)
* Generate workflow files with a Jinja template

Fixes #2686

* Remove sudo from allowlist_externals

* Update workflows

* Add condition to skip generate-workflows

* Update workflows

* Update .github/workflows/generate_workflows_lib/src/generate_workflows_lib/test.yml.j2

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

* Update .github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

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

* Update .github/workflows/generate_workflows_lib/src/generate_workflows_lib/lint.yml.j2

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

* Update .github/workflows/generate_workflows_lib/src/generate_workflows_lib/contrib.yml.j2

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

* Update workflows

* Update workflows

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-08-06 16:27:38 -06:00
Leighton Chen 2a707bccce
Bump version for aws propagator and aws sdk extension for release (#2773) 2024-08-05 10:43:04 -07:00
Riccardo Magliocchetti 8bfae49a7a
requirements: sync grpcio test requirements (#2777) 2024-08-05 10:18:56 -07:00
Ben Beasley 76919d3089
Loosen fastapi-slim version bound to be like the one for fastapi (#2775) 2024-08-05 10:04:48 -07:00
Riccardo Magliocchetti aeac52301a
tox: run tests for real for fastapislim (#2771) 2024-08-05 09:45:13 -07:00
Joshua Fenton 0d28c8b978
Increase test coverage of instrumentation-aws-lambda (#2760) 2024-08-05 09:10:37 -07:00
Emídio Neto ca0dd50c43
bump zipp (#2770) 2024-08-02 14:31:06 -07:00
RJ Duffner 265490fc78
kafka-python Instrument temporary fork, kafka-python-ng inside kafka-python's instrumentation (#2537)
* Instrument temporary fork, kafka-python-ng inside kafka-python's instrumentation

* Make kafkapython-ng run tests
2024-08-02 12:59:17 -06:00
Samuel Colvin 3e18560228
feat: add header extraction parameters to `FastAPIInstrumentor().instrument_app` (#2241)
* add header parameters to FastAPIInstrumentor().instrument_app

* add changelog

* move #2072 changelog to unreleased

* remove accidental pprint

* linting

* future annotations for fastapi

* same logic for instrument()

* Fix lint

* Fix test case

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-08-01 16:15:34 -06:00
Malcolm Rebughini c3e9f75fb9
fix(opentelemetry-instrumentation-celery): attach incoming context on… (#2385)
* fix(opentelemetry-instrumentation-celery): attach incoming context on _trace_prerun

* docs(CHANGELOG): add entry for fix #2385

* fix(opentelemetry-instrumentation-celery): detach context after task is run

* test(opentelemetry-instrumentation-celery): add context utils tests

* fix(opentelemetry-instrumentation-celery): remove duplicated signal registration

* refactor(opentelemetry-instrumentation-celery): fix lint issues

* refactor(opentelemetry-instrumentation-celery): fix types and tests for python 3.8

* refactor(opentelemetry-instrumentation-celery): fix lint issues

* refactor(opentelemetry-instrumentation-celery): fix lint issues

* fix(opentelemetry-instrumentation-celery): attach context only if it is not None

* refactor(opentelemetry-instrumentation-celery): fix lint issues
2024-08-01 15:33:29 -06:00
Daniel Torok 4ea9e5a99a
Fixing w3c baggage support in opentelemetry-instrumentation-aws-lambda (#2589)
* Fixing w3c baggage support in opentelemetry-instrumentation-aws-lambda

* Changelog update

* Passing context not needed

* Fixing unit test after rebase
2024-08-01 15:24:18 -06:00
Emídio Neto fa6a36b8ef
CONTRIBUTING: note to discourage additional contributions that pertain to old HTTP semantic conventions (#2765) 2024-08-01 13:23:06 -07:00
Riccardo Magliocchetti 32e6f6da92
instrumentation/fastapi: fix fastapi-slim support (#2756) 2024-08-01 11:56:41 -07:00
Omar Abdelkader dab664c06e
feat(mysql): add support for mysql-connector-python v9 (#2751) 2024-07-31 10:20:08 -07:00
Diego Hurtado bfcb16b3c0
Update CORE_REPO_SHA (#2755)
Fixes #2754
2024-07-30 14:23:35 -06:00
Leighton Chen c87ffd4a35
HTTP semantic convention stability migration for urllib (#2736) 2024-07-30 11:28:31 -07:00
Ronald d563f8d841
refactor: avoid exception when lambda_handler envs not present in aws-lambda instrumentation (#2750) 2024-07-30 10:53:08 -07:00
Vamsi Kocherla 1c8d8ef536
added conditional calling of `unary_unary` etc functions in `_InterceptorChannel` (#2484) 2024-07-30 10:26:27 -07:00
Leighton Chen b65f67ded5
Re-add `http.target` to Django old sem conv server duration metric (#2746) 2024-07-30 09:55:28 -07:00
Emídio Neto 35cc6f2854
add missing tests to urllib3 after semconv migration (#2748) 2024-07-30 09:43:13 -07:00
Diego Hurtado dbfa6818bf
Add missing requirements and test processor baggage in CI (#2717)
* Add missing requirements and test processor baggage in CI

Fixes #2716

* Add SDK dependency
2024-07-29 16:37:44 -06:00
Leighton Chen 33ad0dc012
Include dummy version upload as part of contributing process to mitig… (#2747) 2024-07-29 11:57:36 -07:00
Emídio Neto c45a6201e2
remove unecessary packages for sqlalchemy tests (#2742) 2024-07-26 09:51:12 -07:00
Emídio Neto 5a48824f4f
Update pyproject.toml (#2740) 2024-07-26 08:13:17 -07:00
Leighton Chen 26ab80925f
Remove extra duration check in fastapi test (#2743) 2024-07-26 08:04:09 -07:00
Pavel Perestoronin 4f985196c6
feat(urllib3)!: refactor request hook parameters (#2711) 2024-07-25 15:08:26 -07:00
Leighton Chen 6690ecc441
add srprash as component owner of aws extension (#2741) 2024-07-25 11:39:17 -07:00
OpenTelemetry Bot 68b20f96c5
Update version to 1.27.0.dev/0.48b0.dev (#2728)
* Update version to 1.27.0.dev/0.48b0.dev

* Update SHA and fix test cases

* Update SHA

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-07-24 21:18:49 -06:00
Diego Hurtado a47810c2a2
Enable global propagator for AWS instrumentation (#2599)
* Enable global propagator for AWS instrumentation

Fixes #2598

* Add entry point test case

* Update instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml

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

* Add test for propagator

* Fix entry point name

* Update instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py

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

* Try with ubuntu latest

* Try with 24.04

* Fix propagator key

* Fix lint

* Revert ununtuns

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
2024-07-24 14:55:21 -06:00
Emídio Neto e799a74bbe
fix schema url in instrumentation tests (#2730)
* fix schema url in instrumentation tests

* change core repo sha for test

* Update CORE_REPO_SHA

* Try removing cache

* Clear cache here as well

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-07-23 17:09:30 -06:00
Emídio Neto 92da527977
HTTP semantic convention stability migration for urllib3 (#2715) 2024-07-23 10:09:11 -07:00
Zhihan Li 38e4ea4a24
Teach fastapi instrumentation about fastapi-slim (#2702) 2024-07-23 09:31:33 -07:00
CC 948b47d43c
Add NoOpTraceProvider test for opentelemetry-instrumentation-logging (#2649) 2024-07-23 08:54:01 -07:00
Emídio Neto cc52bd2729
Fix http clients method attribute in case of non standard http methods (#2726) 2024-07-22 12:56:22 -07:00
Leighton Chen 910d5ec281
HTTP semantic convention stability migration for django (#2714) 2024-07-22 12:02:35 -07:00
GonzaloGuasch a322a0a26b
flask: add `http.target` and `http.route` to metric attributes (#2621) 2024-07-22 09:33:40 -07:00
Riccardo Magliocchetti 6594cdf053
resource/azure: make the version of opentelemetry-instrument more relaxed (#2725) 2024-07-22 09:16:46 -07:00
Leighton Chen fa23d8a7a0
Re-add `opentelemetry-instrumentation-aiohttp-server` to release script (#2722)
* Update .pylintrc

* Update build.sh
2024-07-18 17:47:07 -06:00
Chris Guidry 05073008a3
Re-raise `redis.WatchError`s when they occur (#2721) 2024-07-18 10:11:04 -07:00
Emídio Neto e6c27e0800
Add support to instrument httpx when using proxy (#2664) 2024-07-17 10:46:31 -07:00
Diego Hurtado 5a7935ff1f
Deprecate sklearn instrumentation (#2708)
Fixes #2176
2024-07-16 14:20:02 -06:00
Emídio Neto 24bc71eb2e
Remove package install from aiopg instrumentation (#2712)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-07-16 13:57:38 -06:00
Alex Hall f8f58ee411
Add `http.target` to Django duration metric attributes (#2624) 2024-07-16 11:06:59 -07:00
Emídio Neto 7e48ee7254
HTTP semantic convention stability migration for aiohttp-client (#2673) 2024-07-15 13:49:35 -07:00
Artur Smęt 7c7a2a4312
Add documentation for request/response hooks for requests instrumentor (#2704) 2024-07-15 10:24:16 -07:00
Zhihan Li 7567efa341
Handle redis.exceptions.WatchError as a non-error event in instrumentation (#2668) 2024-07-15 10:09:36 -07:00
Riccardo Magliocchetti 432d6f570c
instrumentation/django: bump django 4.2 to 4.2.14 (#2700) 2024-07-15 09:54:14 -07:00
Riccardo Magliocchetti 6bc48be45a
exporter/prometheus-remote-write: bump certifi to latest (#2701)
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-07-12 17:34:34 -06:00
Gustavo Carvalho 15f3b97d5a
Improved Test Coverage for HTTP Utility's IP Setting Functionality (#2693) 2024-07-12 15:44:44 -07:00
Leighton Chen 6293d6a991
HTTP semantic convention stability migration for fastapi (#2682) 2024-07-12 11:48:04 -07:00
Leighton Chen 5a27946920
Add Emídio Neto as an approver (#2703) 2024-07-12 10:49:48 -07:00
Daniel Hochman b697f4ab9a
opentelemetry-instrumentation-asgi: always set status code on duration attributes (#2627) 2024-07-12 09:38:40 -07:00
Zhihan Li 43dfc73c4c
add sync and async test guide at contributing.md (#2694) 2024-07-11 09:34:59 -07:00
mspillane bbbe3ab7ab
Add NoOpTracerProvider test for starlette (#2654) 2024-07-11 09:18:48 -07:00
Riccardo Magliocchetti 60fb936b7e
instrumentation/asyncio: catch CancelledError exception in tests (#2690)
* instrumentation/asyncio: catch CancelledError exception in tests

After a29242f493 we are re-raising the
CancelledError so we need to catch it on the caller side.

Fix #2688

* instrument/asyncio: don't test anext on python < 3.10

Since it's not available there.

* instrumentation/asyncio: use unittest.skipIf instead of reimplementing it

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-07-10 12:34:39 -06:00
Riccardo Magliocchetti 0b20c955fa
exporter/prometheus-remote-write: fix test requirements for pypy (#2692) 2024-07-10 10:31:35 -07:00
Emídio Neto b1b9be0813
Fix lint-instrumentation-mysqlclient in tox.ini (#2691) 2024-07-10 10:20:44 -07:00
Riccardo Magliocchetti 15fd1de93f
Bump certifi and zipp (#2689)
* requirements: bump zipp to 3.19.2

To resolve a dependabot securiy report.

* requirements: bump certifi to 2024.7.4

To resolve a dependabot security report.
2024-07-10 09:24:05 -06:00
Diego Hurtado 5ff46ac9d1
Move benchmarks outside of tests directory (#2670)
Fixes #2669
2024-07-09 17:17:00 -06:00
Emídio Neto c8e529e437
Update CHANGELOG.md (#2665) 2024-07-09 09:55:16 -07:00
Emídio Neto 3518974d6e
Fix typos in tox.ini (#2666) 2024-07-05 13:07:11 -06:00
Emídio Neto c4c9b6b9a1
Add capture to open file descriptors in system metrics instrumentation (#2652)
* add capture to open file descriptors in system metrics instrumentation

* fix meter type

* fix pypy test

* add changelog entry

* Update instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py

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

* remove runtiem prefix

* update tests

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-07-05 11:40:19 -06:00
Diego Hurtado 75faaad986
Remove unnecessary dependencies (#2663)
* Remove unnecessary dependencies

Fixes #2661

* Separate runs

* Remove dev-requirements from test environment

* Try without negative if

* Remove positive if

* Remove if

* Separate benchmark-containing packages in another file

* Add missing test-requirements.txt file
2024-07-04 16:04:53 -06:00
Bart Vanbrabant c272e68774
Support cursor based queries (#2501)
* Support cursor based queries

* Add unit test

* Start of a test case

* Update tests

* Mock out all connection stuff

* Run black

* Fix typo

* Use old python

* Run black on the tests

* Add changelog

* Fix sorting

* Use python 3.8 as baseline

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-07-03 17:47:04 -06:00
Diego Hurtado fcc67514f5
Do not run benchmark tests in CI (#2660)
* Do not run benchmark tests in CI

Fixes #2659

* Add benchmark skip

* Update .github/workflows/test.yml

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

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-07-03 17:22:45 -06:00
Diego Hurtado a9247774c4
Point pylint to the package root directories (#2658)
* Point pylint to the root directories

Fixes #2657

* Use cd with instrumentations

* Do the same for the rest of the components

* Specify pylint configuration file

* Fix tox lint for sio-pika

* Fix commands for util-http and azure detector

* Fix lint for sdk-extension-aws

* Fix lint for opentelemetry-instrumentation

* Fix lint for grpc instrumentation

* Fix lint for opentelemetry-instrumentation
2024-07-03 16:22:00 -06:00
Emídio Neto 7da7f554ea
HTTP semantic convention stability migration for httpx (#2631) 2024-07-03 12:43:47 -07:00
Leighton Chen c9bad6269c
HTTP transition for asgi (#2610) 2024-07-03 11:19:34 -07:00
Emídio Neto a3e457ca8c
add opentelemetry-util-http to CI (#2655) 2024-07-03 11:00:27 -07:00
Riccardo Magliocchetti 8821a95202
Test and lint opentelemetry-resource-detector-azure (#2651) 2024-07-03 10:51:42 -07:00
dhofstetter ef4bc9f9b4
fix(opentelemetry-instrumentation-asgi): Correct http.url attribute generation (#2477) 2024-07-03 10:28:54 -07:00
Eddie Bracho b16394b202
[opentelemetry-instrumentation-django] Handle exceptions from request/response hooks (#2153) 2024-07-02 11:41:55 -07:00
Riccardo Magliocchetti 77749225b7
opentelemetry-processor-baggage: silence ruff warning (#2653) 2024-07-02 11:32:39 -07:00
Hollis Wu 90211489a3
Handle empty statement in psycopg instrumentation (#2644) 2024-07-02 09:05:41 -07:00
joshschltelus df3415b0dd
Confluent Kafka: Ensure consume span is ended when consumer is closed (#2640) 2024-07-02 08:43:32 -07:00
Radoslav Kirilov a29242f493
fix(async-io): instrumented `asyncio.wait_for` properly raises `asyncio.TimeoutError` (#2637) 2024-07-02 08:21:15 -07:00
Emídio Neto 529178d9ae
Fix wrong unit in Flask new semconv test (#2645) 2024-07-01 09:35:10 -07:00
joshschltelus 58a6d3a79c
conflent-kafka: Proxy producer purge (#2638) 2024-06-27 10:19:50 -07:00
Riccardo Magliocchetti 7f7c0f31fe
Use python baseline for pylint (#2636) 2024-06-26 12:35:11 -07:00
Emídio Neto f531996f53
fix util-http package (#2634) 2024-06-26 09:34:04 -07:00
Emídio Neto ff17c79c16
Update contributing guide and remove test instructions from readme (#2632) 2024-06-25 09:54:48 -07:00
Riccardo Magliocchetti 3d758a973c
instrumentation/system-metrics: permit to use psutil 6.0 (#2630) 2024-06-24 09:31:04 -07:00
Riccardo Magliocchetti 919b2c295f
CHANGELOG: remove spurious backtick (#2628)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-06-22 12:44:55 +03:00
shwejan raj 593f86fd04
Adds NoOpTracerProvider test case for pymysql instrumentation (#2581) 2024-06-21 12:25:01 -07:00
Mathieu Pichette a166208616
confluent_kafka: extend instruments version declaration to include 2.4.0 (#2616)
* confluent_kafka: update instruments version declaration to include 2.4.0

* Adjust CHANGELOG.md with actual PR number

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-06-20 16:51:28 -06:00
Samuel Colvin f6ed62a7aa
Repeated headers list for ASGI frameworks (#2361)
* avoid loosing repeated HTTP headers

* fix fof wsgi, test in falcon

* add changelog

* add more tests

* linting

* fix falcon and flask

* remove unused test

* Use a list for repeated HTTP headers

* linting

* add changelog entry

* update docs and improve fastapi tests

* revert changes in wsgi based webframeworks

* fix linting

* Fix import path of typing symbols

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-06-20 16:37:26 -06:00
Fools a61739c9c2
bugfix: AWS Lambda event source key incorrect for SNS in instrumenta… (#2612) 2024-06-20 10:50:31 -07:00
Riccardo Magliocchetti 41ca9027a8
instrumentation: drop dead code from aiohttp-client tests (#2625) 2024-06-20 10:42:48 -07:00
Rytis Bagdziunas feed69bcc7
Upgrade Werkzeug library for testing (#2623) 2024-06-20 10:35:28 -07:00
Rytis Bagdziunas fecb1e2862
Added recording of exceptions in Pyramid (#2622) 2024-06-20 10:19:20 -07:00
Fools b776ac92a8
Update CONTRIBUTING.md (#2620) 2024-06-20 10:06:14 -07:00
Riccardo Magliocchetti 3669b477bd
requirements: Bump urllib3 to latest (#2618) 2024-06-20 09:26:01 -07:00
Riccardo Magliocchetti d93afc8773
Bump docs and dev requirements with dependabot security warnings (#2614) 2024-06-20 08:48:06 -07:00
Riccardo Magliocchetti 4a75c535a7
boto: bump cryptography in test requirements (#2615) 2024-06-20 08:39:13 -07:00
Leighton Chen b94c5906fd
Use generated symbols from semantic conventions package (#2611) 2024-06-17 09:20:17 -07:00
Riccardo Magliocchetti daa84a6c63
instrumentation/tornado: bump to latest 6.4.1 in test-requirements (#2606) 2024-06-14 10:20:50 -07:00
Riccardo Magliocchetti 91a69d4c99
aiohttp: bump aiohttp in test requirements to latest (#2607) 2024-06-14 10:11:24 -07:00
Riccardo Magliocchetti 795c93376c
instrumentation/pymysql: bump pymysql to 1.1.1 in test requirements (#2608) 2024-06-14 10:01:11 -07:00
Emídio Neto 6be205e604
consistently use of suppress_instrumentation utils (#2590) 2024-06-14 09:53:28 -07:00
Diego Hurtado 881a179e3b
Add xray propagators that prioritizes xray environment variable (#2573)
* Add AwsXrayLambdaPropagator

Fixes #2457

* Remove unnecessary AWS_TRACE_HEADER_PROP

* Add docstring

* Fix nit

* Add no environment variable test case

* Add test case for valid context

* Remove ipdb

* Fix lint

* Add missing entry point
2024-06-13 17:50:45 -06:00
Riccardo Magliocchetti 361da3e45e
botocore: bump moto to latest (#2605)
So we can bump Werkzeug too.
2024-06-13 16:56:04 -06:00
Riccardo Magliocchetti 477b73cd9a
requirements: bump requests to 2.32.3 (#2603) 2024-06-12 08:14:11 -07:00
Emídio Neto 184d8d45b9
Change issue templates to forms (#2602) 2024-06-12 08:02:24 -07:00
Emídio Neto da78275a55
increase delta for fastapi flaky test (#2591) 2024-06-11 10:16:18 -07:00
Riccardo Magliocchetti af9675cf04
requirements: bump sqlparse to 0.5.0 (#2595) 2024-06-11 09:44:16 -07:00
Riccardo Magliocchetti 20e68e38e7
requirements: bump Jinja2 to 3.1.4 (#2593) 2024-06-11 09:18:56 -07:00
Riccardo Magliocchetti ab0ea0e0f9
Add support for python 3.12 (#2572) 2024-06-10 12:49:10 -07:00
Riccardo Magliocchetti 97621523b8
requirements: bump Werkzeug (#2594) 2024-06-10 09:08:14 -07:00
Riccardo Magliocchetti 4357c35dd2
requirements: missed pytest and idna bumps (#2592) 2024-06-10 08:59:40 -07:00
Riccardo Magliocchetti 3511ed180d
requirements: Bump idna to 3.7 (#2583) 2024-06-07 12:54:38 -07:00
Riccardo Magliocchetti 0216a9644a
CONTRIBUTING: Make it more explicit you need to sign the CLA (#2582) 2024-06-07 09:14:21 -07:00
Riccardo Magliocchetti bc4b0493b9
requirements: bump pytest to 7.4.4 (#2587) 2024-06-07 08:53:22 -07:00
Leighton Chen 5b841282ab
Do not use `asgi` name and version for tracer/meter for instrumentations using Asgi Middleware (#2580) 2024-06-06 12:52:32 -07:00
Leighton Chen bb9eebb73e
Fix readme formatting and markdown (#2576) 2024-06-05 15:27:12 -07:00
soumyadeepm04 e306aba7ec
removed references to [test] extras from eachdist script (#2578) 2024-06-05 11:35:48 -07:00
Riccardo Magliocchetti 95fea2bfa7
Fix running async psycopg tests (#2540) 2024-06-05 11:14:44 -07:00
Leighton Chen c06fd1dd53
Update README.rst (#2575) 2024-06-04 09:19:48 -07:00
Alex Boten 768694cf75
add processor directory to build.sh (#2574) 2024-06-03 14:20:09 -07:00
Pavel Perestoronin ed51ebb312
feat(asgi,fastapi,starlette)!: provide both send and receive hooks with `scope` and `message` (#2546) 2024-06-03 10:18:47 -07:00
OpenTelemetry Bot 73d0fa46a9
Copy change log updates from release/v1.25.x-0.46bx (#2571) 2024-05-31 10:00:14 -07:00
Leighton Chen 55c829b6c4
Update release.yml 2024-05-31 09:04:58 -07:00
OpenTelemetry Bot 0db9dbe311
Update version to 1.26.0.dev/0.47b0.dev (#2568) 2024-05-30 18:48:51 -07:00
Rytis Bagdziunas dc711e870e
Ensure httpx non-client methods are instrumented (#2538)
* Ensure httpx non-client methods are instrumented

* Update changelog

* Added subTest to distinguish tests inside a loop

* Updated changelog

* Add a comment explaining private attribute usage

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-05-30 22:48:22 +00:00
Alexander Shadchin 728976fb10
Fix net peer attribute for unix socket connection (#2493) 2024-05-30 14:50:53 -07:00
dferrochio 41792e7bb3
Add confluent kafka producer poll and flush returns (#2527) 2024-05-30 14:27:35 -07:00
Emídio Neto 7bddbb5419
fix: remove dependency on sdk for system-metrics instrumentation (#2557) 2024-05-29 10:17:50 -07:00
Riccardo Magliocchetti bd9156fff8
Remove unrelated packages from test requirements (#2559)
* botocore: remove random packages from test-requirements

Refs #1736

* boto: remove random packages from test requirements

Refs #1736

* tox: re-enable boto3sqs tests with pypy3

* threading: remove confluent-kafka from test requirements
2024-05-29 09:56:27 -06:00
Riccardo Magliocchetti 25e429aaf9
instrumentation: revise BaseDistro.load_instrumentor documentation (#2530) 2024-05-28 16:18:09 -07:00
Riccardo Magliocchetti f7cef14739
distro: decouple default configuration test from environment (#2561) 2024-05-28 14:56:38 -07:00
Riccardo Magliocchetti ac97b00457
Fix typos in test names (#2558) 2024-05-28 14:31:44 -07:00
Mike Goldsmith 59a737c285
Add key predicate to baggage span processor (#2535)
* Add key predicate to baggage span processor

* add changelog entry

* fix linting

* more linter fixes

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-05-28 12:49:00 -06:00
Martin Stolle 88111d0a83
fix(requests): Fix wrong time unit for duration histogram (#2553) 2024-05-28 11:34:28 -07:00
Riccardo Magliocchetti eb8e45695e
elasticsearch: don't produce spans if native elasticsearch support is enabled (#2524) 2024-05-24 13:13:37 -07:00
Tim Hutchinson 65b4f850a0
Preserve brackets around literal IPv6 hosts (#2552) 2024-05-24 12:06:53 -07:00
Riccardo Magliocchetti e6409568c1
Reenable pylint broad exception (#2536) 2024-05-24 11:12:53 -07:00
Riccardo Magliocchetti c1a51fde96
Pre Python 3.12 enablement fixes (#2529) 2024-05-24 10:57:29 -07:00
Leighton Chen 78285a5795
Pin codespell version to fix builds (#2550) 2024-05-24 10:49:18 -07:00
Povilas Versockas 66a107fa49
fix(async-io): return coro when __name__ is not present (#2541) 2024-05-23 16:28:50 -07:00
Adin Hodovic da75015fad
fix: Ensure compability with Psycopg3 to extract libpq build version (#2500)
* fix: Ensure compability with Psycopg3 to extract libpq build version

Struggling with getting dbapi and psycopg3 working.

Think this is the error, __libpq_version does not exist on psycopg3

https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/pq/pq_ctypes.py#L1220

* docs: Add changelog entry

* docs: Fix spelling

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-05-23 12:02:46 +03:00
Jeremy Voss c28f9b837f
Update functions detector readme (#2533) 2024-05-22 10:45:10 -07:00
Povilas Versockas f4f3042f85
fix(async-io): check for __name__ atribute when tracing coroutine (#2521) 2024-05-21 21:48:54 -07:00
Leighton Chen f8758c6902
Implement functions resource detector (#2523)
* Update .pylintrc

* fn

* Update CHANGELOG.md

* commments

* Add deployment.environment to functions detector

* Revert "Add deployment.environment to functions detector"

This reverts commit 5411759711.

* Remove deployment.environment from readme

* Release 0.1.5

---------

Co-authored-by: jeremydvoss <jerevoss@gmail.com>
2024-05-16 15:05:21 -06:00
Guillermo 460fc33583
Fix typo in sample code (#2494)
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-05-15 12:52:59 +03:00
Diego Hurtado d0500c2f8a
Add error handling to opentelemetry-bootstrap -a (#2517)
* Revert "Refactor bootstrap generation (#2101)"

This reverts commit 1ee7261ea7.

* Add error handling to opentelemetry-bootstrap -a

Fixes #2516

---------

Co-authored-by: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com>
2024-05-14 15:26:31 -05:00
Riccardo Magliocchetti 6a40ffd905
elasticsearch: tests against elasticsearch 8 (#2420)
* elasticsearch: bump handled version to 6.0

After 4de0e5659d

* elasticsearch: tests against elasticsearch 8
2024-05-14 14:59:41 -05:00
Federico Bond 9b7197d3b9
docs: fix name of response hook signature in botocore instrumentation (#2512) 2024-05-13 10:24:24 -07:00
Riccardo Magliocchetti 46d2ce6ace
Reinstate tox -e lint (#2482) 2024-05-10 09:51:32 -07:00
dependabot[bot] eabceff062
Bump jinja2 from 3.1.3 to 3.1.4 (#2503)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.
- [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.3...3.1.4)

---
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: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-05-09 13:53:12 -05:00
hyfj44255 935f51eb8e
upgrade pymongo to avoid CWE-125 vulnerability issue (#2497)
Signed-off-by: Yang, Robin <Robin.Yang@fmr.com>
2024-05-09 10:14:08 -05:00
Allen Kim bc804a3b07
Bugfix/check future cancelled (#2461)
* Calling the exception() method when future is in the cancelled state is causing a CancelledError

Calling the exception() method when future is in the cancelled state is causing a CancelledError. we should check the cancelled state first and call f.exception() only if it's not cancelled.

* modify lint

* modify lint

* Update CHANGELOG.md

* remove init()

* add future cancelled test code

* add future cancelled test code

* add future cancelled test code

* add future cancelled test code

* add future cancelled test code

* add future cancelled test code

* lint

* lint

* remove if condition

* modify test code

* lint

* lint

* remove pytest

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-05-07 18:40:21 -05:00
Akshay Awate 0a231e57f9
Update README.rst (#2499)
* Update README.rst

Fix README hyperlink syntax.

* updated README
2024-05-06 11:51:39 -05:00
Aaron Abbott 1d3dea0475
Remove SDK dependency from opentelemetry-instrumentation-grpc (#2474)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2024-05-04 15:47:19 -05:00
Diego Hurtado 1ee7261ea7
Refactor bootstrap generation (#2101)
* Refactor bootstrap generation

This makes the bootstrap script get the package version directly from
pypi instead of from our lists of packages. This makes sure that the
packages are actually available for the end user to install.

Fixes #2053

* Fix lint

* Fix lint

* Remove aiohttp

* Add missing dependency for aiohttp-client

* Use hatch version
2024-05-02 18:05:49 -05:00
Riccardo Magliocchetti 2a174b2543
CONTRIBUTING: introduce pre-commit (#2479) 2024-05-02 10:11:02 -07:00
Diego Hurtado 5116305f77
Separate lint into several jobs (#2467)
* Separate lint for flask

* Seaparate lint for resource-detector-container

* Add linting workflow

* Update contributing documentation

* Fix lint workflow

* Add fix for resource-detector-container

* Separate lint for sdk-extension-aws

* Separate lint for distro

* Separate lint for opentelemetry-instrumentation

* Separate lint for aiohttp-client

* Separate lint for aiohttp-server

* Separate lint for aiopg

* Separate lint for aws-lambda

* Separate lint for botocore

* Separate lint for boto3sqs

* Separate lint for django

* Separate lint for dbapi

* Separate lint for boto

* Separate lint for elasticsearch

* Separate lint for falcon

* Separate lint for fastapi

* Separate lint for urllib

* Separate lint for urllib3

* Separate lint for requests

* Separate lint for starlette

* Separate lint for jinja2

* Seaparate lint for logging and richconsole

* Separate lint for prometheus-remote-write

* Separate lint for mysql

* Separate lint for mysqlclient

* Separate lint for psycopg2

* Separate lint for psycopg

* Separate lint for pymemcache

* Separate lint for pymongo

* Separate lint for pymysql

* Separate lint for pyramid

* Separate lint for asgi

* Separate lint for asyncpg

* Separate lint for sqlite3

* Separate lint for wsgi

* Separate lint for grpc

* Separate lint for sqlalchemy

* Separate lint for redis

* Separate lint for remoulade

* Separate lint for celery and sklearn

* Separate lint for system-metrics

* Separate lint for threading

* Separate lint for tornado

* Separate lint for tortoiseorm

* Separate lint for httpx

* Separate lint for propagator-aws-xray

* Remove lint

* Separate lint for propagator-ot-trace

* Separate lint for sio-pika

* Separate lint for aio-pika

* Fix aio and sio pika

* Separate lint for kafka-python

* Separate lint for confluent-kafka

* Separate lint for asyncio

* Separate lint for cassandra

* Separate lint for processor-baggage

* Remove lint test environment

* Rename lint workflow file

* Fix sio-pika lint testing package path

* More fixes

* Fix linting for opentelemetry-instrumentation

* Add section for linting with 3.8

* Add missing lint install command for elasticsearch

* Sorted packages
2024-04-30 09:05:49 -05:00
Riccardo Magliocchetti de7ce0fb22
Use local imports when importing from tests (#2464) 2024-04-29 11:49:08 -07:00
Leighton Chen 2493258af1
Ignore vm detector if already in other rps for azure resource detector (#2456) 2024-04-29 10:53:01 -07:00
Riccardo Magliocchetti 58f3d87b78
gen-requirements: Bump jinja to latest one (#2463) 2024-04-29 10:35:04 -07:00
Riccardo Magliocchetti 3291f38e8d
elasticsearch: test against elasticsearch 7 (#2431)
* Update core repo SHA

* elasticsearch: test against elasticsearch 7

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-28 09:20:17 -05:00
Diego Hurtado bd4a22a0d9
Remove unnecessary package installations (#2424)
* Remove unnecessary dependency installations

Fixes #2423

* Fix tox.ini merge conflicts
2024-04-25 16:23:22 -05:00
Leighton Chen c8d5f851ed
HTTP transition for flask (#2454) 2024-04-25 10:40:03 -07:00
Alessandro Bologna d5b5925cf8
Fix exception handling for events with requestContext (#2418)
* Fix exception handling for events with requestContext

* added entry to changelog

* reformatted with black

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-25 10:57:39 -05:00
Alex Boten 5375acf534
new(opentelemetry-processor-baggage): add new component (#2436)
* new(opentelemetry-processor-baggage): add new component

Fixes #2428

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* add tests

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* update changelog

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* update component owners

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* lint

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* update license

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* fix lint

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* lint

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

* rename processors dir to processor

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-04-25 10:25:34 -05:00
Riccardo Magliocchetti a0c3211c4f
Bump black to 24.3.0 (#2452) 2024-04-23 08:45:48 -07:00
Riccardo Magliocchetti 1cd8ccb28a
CHANGELOG: deduplicate unreleased entries (#2451) 2024-04-23 08:15:22 -07:00
Prakhar Birla 0980486f2f
Fix compatibility issue aio-pika instrumentation (#2450)
* - fixed compatibility issue in set_channel of span_builder.py
- changed test-requirements-2.txt to use aio-pika==9.0.5
- added test-requirements-3.txt to use aio-pika==9.4.1 (latest atm)
- tox.ini: fixed incorrect commands_pre which would always install test-requirements-2.txt and cause dep installation conflict
- tox.ini: added aio-pika-3 commands

* Add version comment for aio-pika

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-22 23:53:59 +00:00
Nick Nicolini 5cb4dab364
Use sqlalchemy version in sqlalchemy commenter instead of opentelemetry library version (#2404)
* Use sqlalchemy version in sqlalchemy commenter instead of opentelemetry library version

The SqlAlchemy commenter is currently using the library version in the comment it emits, e.g.:

```
{
  'db_driver': 'psycopg2', 
  'db_framework': 'sqlalchemy:0.45b0'
}
```

We should instead be using the sqlalchemy version here, as SqlCommenter did before

* Fix lint

* Fix lint

* Add CHANGELOG entry

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-22 18:04:20 -05:00
Matt Oberle c644f0d7d5
[boto3sqs] Instrument `Session` and `resource` (#2161)
* [boto3sqs] Instrument `Session` and `resource`

This commit addresses the following open issues:

- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1699
- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1996

There are four ways to access the SQS API via `boto3`:

- `client = boto3.client("sqs")`
- `client = boto3.Session().client("sqs")`
- `sqs = boto3.resource("sqs")`
- `sqs = boto3.Session().resource("sqs")`

The existing wrapper tied into `boto3.client` to wrap a generated `botocore.client.SQS` class.
The change here covers the three missing initialization methods.

* update changelog

* rename duplicate test methods

* implement uninstrument

* [boto3sqs] Reduce number of wrapper targets

There are actually 6 ways to initialize a boto3 API object.

```py
boto3.client()              # Using default global session
boto3.resource()            # Using default global session
boto3.Session().client()    # Using "re-exported" session.Session
boto3.Session().resource()  # Using "re-exported" session.Session

boto3.session.Session().client()    # Using session.Session directly
boto3.session.Session().resource()  # Using session.Session directly
```

We only have to patch `session.Session.client` to catch all the cases.

- b3c158c62a/boto3/session.py (L217-L229)
- b3c158c62a/boto3/session.py (L446-L457)

* Remove unused import

---------

Co-authored-by: Matt Oberle <mattoberle@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-22 22:44:31 +00:00
Diego Hurtado 4e90498bf3
Update action versions (#2441)
Fixes #2440

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-04-22 15:34:27 -05:00
Diego Hurtado 2718ffc7a7
Fix elasticsearch test requirements file name (#2443)
Fixes #2442

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-04-22 13:48:51 -05:00
Severin Neumann 7f4853ac79
fix: revert modifications to Apache license (#2429)
* fix: revert modifications to Apache license

See open-telemetry/community#2056 for background

* path all LICENSE files

Signed-off-by: svrnm <neumanns@cisco.com>

* Fix missing LICENSE files

---------

Signed-off-by: svrnm <neumanns@cisco.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-22 13:23:38 -05:00
Gal Bashan ad06e7043c
feat(pika): adding support for channel.consume instrumentation (#2397)
* feat(pika): adding support for channel.consume instrumentation

* updated changelog

* wip tests

* updating docs

* more tests

* removing span member on object proxy

* adding test for ReadyMessagesDequeProxy

* adding tests

* better comment on span.end()

* fixing docs

* ending span even on exceptions
2024-04-21 14:11:39 +03:00
Leighton Chen 2317adcc34
HTTP transition for wsgi (#2425) 2024-04-19 10:59:05 -07:00
Léni 7656bdb8fe
fix(grpc): aio grpc client interceptor incorrect metadata handling (#2363) 2024-04-18 11:33:42 -07:00
Riccardo Magliocchetti 4de0e5659d
elasticsearch: stop testing on ancient versions (#2422)
Pick 6.0 as the baseline.
2024-04-18 08:57:26 -05:00
Riccardo Magliocchetti 9ce1c26d27
django: Bump django version to latest (#2427) 2024-04-17 11:19:34 -07:00
Riccardo Magliocchetti ab50a4e151
tox: stop testing on python < 3.8 (#2414) 2024-04-17 10:08:18 -07:00
Emídio Neto 82b07959a9
fix: instrumentation-celery test tasks CustomError (#2416)
* fix: instrumentation-celery test tasks CustomError

* chore: lint

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-04-17 11:48:09 -05:00
Tammy Baylis 07318bd378
Change AwsLambdaInstrumentor span attrs to meet faas semconv (#2372) 2024-04-17 09:09:55 -07:00
Leighton Chen 99678ccd3a
Add section for semantic convention status for instrumentations (#2433) 2024-04-16 14:04:17 -07:00
John Bley 8322ee790e
Fix all issues from shellcheck --severity=warning (#2354) 2024-04-16 09:36:37 -07:00
Riccardo Magliocchetti e84bfff6cf
readthedocs: update build os config (#2389) 2024-04-15 09:26:57 -07:00
Changemyminds a5c48871fa
feat: add opentelemetry-instrumentation-threading library (#2253)
* feat: add opentelemetry-instrumentation-threading library

* fix: update python file with black formatter

* fix: modified title underline too short issue

* fix: modified library sorted via isort tool

* fix: modified CHANGELOG.md and remove unused parameter

* test: migrated unit test cases from the #1582 to this project

* chroe: updated the tox.ini test commands

* fix: fixed the lint issue

* feat: support ThreadPool and update document

* fix: fixed the lint issue

* refactor: remove redundant class and simplify capture OTel context usage

* fix: removed unused parameter

* test: added a new test case for thread pool

* fix: remove unused return response

* refactor: compared the array

* fix: remove f-string

* fix: fixed pylint issue

* fix: test library

* fix: updated CHANGELOG.md

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2024-04-11 11:57:19 -05:00
abstractOwl 804a9090a1
Add AWS resource detector entry points (#2382) 2024-04-10 10:05:38 -07:00
Leighton Chen fdb2e141d4
Update contrib repo approvers list (#2395) 2024-04-09 10:49:26 -07:00
Jeremy Voss fdcbbddb6c
Azure resource detector 0.1.4 (#2394) 2024-04-05 10:26:36 -07:00
Leighton Chen 85ca0a6b80
Change meta data service timeout to 200ms (#2387) 2024-04-05 09:47:10 -07:00
Samuel Colvin 805c72ceff
rename `type` to `asgi.event.type` in ASGI instrumentation (#2300) 2024-04-04 17:10:30 +00:00
Leighton Chen 955b483f7a
Remove context manager check (#2391) 2024-04-03 18:44:09 -05:00
OpenTelemetry Bot 24eadcf63d
Update version to 1.25.0.dev/0.46b0.dev (#2376) 2024-03-28 14:25:18 -07:00
936 changed files with 88885 additions and 9145 deletions

33
.flake8
View File

@ -1,33 +0,0 @@
[flake8]
ignore =
# line too long, defer to black
E501
# allow line breaks before binary ops
W503
# allow line breaks after binary ops
W504
# allow whitespace before ':' (https://github.com/psf/black#slices)
E203
exclude =
.bzr
.git
.hg
.svn
.tox
CVS
.venv*/
venv*/
target
__pycache__
exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/gen/
exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/
exporter/opentelemetry-exporter-jaeger/build/*
docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/grpc/gen/
docs/examples/opentelemetry-example-app/build/*
opentelemetry-proto/build/*
opentelemetry-proto/src/opentelemetry/proto/
scripts/*

View File

@ -1,19 +0,0 @@
---
name: Bug Report
about: Create a report to help us improve
labels: bug
---
**Describe your environment** Describe any aspect of your environment relevant to the problem, including your Python version, [platform](https://docs.python.org/3/library/platform.html), version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
**Steps to reproduce**
Describe exactly how to reproduce the error. Include a code sample if applicable.
**What is the expected behavior?**
What did you expect to see?
**What is the actual behavior?**
What did you see instead?
**Additional context**
Add any other context about the problem here.

66
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View File

@ -0,0 +1,66 @@
---
name: Bug Report
description: Create a report to help us improve
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Please make sure to fill out the entire form below, providing as much context as you can in order to help us triage and track down your bug as quickly as possible.
Before filing a bug, please be sure you have searched through [existing bugs](https://github.com/open-telemetry/opentelemetry-python-contrib/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug) to see if your bug is already addressed.
- type: textarea
id: environment
attributes:
label: Describe your environment
description: |
Please describe any aspect of your environment relevant to the problem, including your Python version, [platform](https://docs.python.org/3/library/platform.html), version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
value: |
OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.9.10)
Package version: (e.g., 0.46.0)
- type: textarea
attributes:
label: What happened?
description: Please provide as much detail as you reasonably can.
validations:
required: true
- type: textarea
attributes:
label: Steps to Reproduce
description: Provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) if possible and the needed steps to reproduce the problem.
validations:
required: true
- type: textarea
attributes:
label: Expected Result
description: What did you expect to see?
validations:
required: true
- type: textarea
attributes:
label: Actual Result
description: What did you see instead?
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here.
placeholder: Any additional information...
- type: dropdown
id: contribute
attributes:
label: Would you like to implement a fix?
description: For guidance on how to get started, refer to the [contribution guide](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md).
options:
- "No"
- "Yes"

4
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,4 @@
contact_links:
- name: Slack
url: https://cloud-native.slack.com/archives/C01PD4HUVBL
about: Or the `#otel-python` channel in the CNCF Slack instance.

View File

@ -1,19 +0,0 @@
---
name: Feature Request
about: Suggest an idea for this project
labels: feature-request
---
Before opening a feature request against this repo, consider whether the feature should/could be implemented in the [other OpenTelemetry client libraries](https://github.com/open-telemetry/). If so, please [open an issue on opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) first.
**Is your feature request related to a problem?**
If so, provide a concise description of the problem.
**Describe the solution you'd like**
What do you want to happen instead? What is the expected behavior?
**Describe alternatives you've considered**
Which alternative solutions or features have you considered?
**Additional context**
Add any other context about the feature request here.

View File

@ -0,0 +1,50 @@
---
name: Feature Request
description: Suggest an idea for this project
labels: [feature-request]
body:
- type: markdown
attributes:
value: |
Before opening a feature request against this repo, consider whether the feature should/could be implemented in the [other OpenTelemetry client libraries](https://github.com/open-telemetry/). If so, please [open an issue on opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) first.
- type: textarea
id: related-problem
attributes:
label: What problem do you want to solve?
description: Is your feature request related to a problem? If so, provide a concise description of the problem.
placeholder: Describe the problem and include relevant issue IDs
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: What do you want to happen instead? What is the expected behavior?
placeholder: I'd like to ...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: Which alternative solutions or features have you considered?
placeholder: Some potential solutions
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Add any other context about the feature request here.
placeholder: Some related requests in other projects or upstream spec proposals.
validations:
required: false
- type: dropdown
id: contribute
attributes:
label: Would you like to implement a fix?
description: |
For guidance on how to get started, refer to the [contribution guide](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md).
options:
- "No"
- "Yes"

View File

@ -11,6 +11,9 @@ components:
- oxeye-nikolay
- nikosokolik
instrumentation/opentelemetry-instrumentation-asyncclick:
- jomcgi
instrumentation/opentelemetry-instrumentation-kafka-python:
- nozik
@ -35,6 +38,7 @@ components:
sdk-extension/opentelemetry-sdk-extension-aws:
- NathanielRN
- Kausik-A
- srprash
instrumentation/opentelemetry-instrumentation-tortoiseorm:
- tonybaloney
@ -44,27 +48,13 @@ components:
instrumentation/opentelemetry-instrumentation-urllib:
- shalevr
- ocelotl
instrumentation/opentelemetry-instrumentation-urllib3:
- shalevr
- ocelotl
instrumentation/opentelemetry-instrumentation-sqlalchemy:
- shalevr
instrumentation/opentelemetry-instrumentation-flask:
- ocelotl
instrumentation/opentelemetry-instrumentation-jinja2:
- ocelotl
instrumentation/opentelemetry-instrumentation-logging:
- ocelotl
instrumentation/opentelemetry-instrumentation-requests:
- ocelotl
instrumentation/opentelemetry-instrumentation-cassandra:
- mattcontinisio
@ -73,3 +63,21 @@ components:
instrumentation/opentelemetry-instrumentation-psycopg:
- federicobond
instrumentation/opentelemetry-instrumentation-pymssql:
- guillaumep
instrumentation/opentelemetry-instrumentation-aiokafka:
- dimastbk
processor/opentelemetry-processor-baggage:
- codeboten
instrumentation-genai/:
- karthikscale3
- lmolkova
- lzchen
- gyliu513
- nirga
- alizenhom
- codefromthecrypt

11
.github/scripts/update-version-patch.sh vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash -e
sed -i "/\[stable\]/{n;s/version=.*/version=$1/}" eachdist.ini
sed -i "/\[prerelease\]/{n;s/version=.*/version=$2/}" eachdist.ini
./scripts/eachdist.py update_patch_versions \
--stable_version=$1 \
--unstable_version=$2 \
--stable_version_prev=$3 \
--unstable_version_prev=$4

View File

@ -16,7 +16,7 @@ jobs:
exit 1
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# history is needed to run git cherry-pick below
fetch-depth: 0
@ -40,4 +40,4 @@ jobs:
gh pr create --title "[$GITHUB_REF_NAME] $title" \
--body "Clean cherry-pick of #$NUMBER to the \`$GITHUB_REF_NAME\` branch." \
--head $branch \
--base $GITHUB_REF_NAME
--base $GITHUB_REF_NAME

View File

@ -18,7 +18,7 @@ jobs:
&& github.actor != 'opentelemetrybot'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check for CHANGELOG changes
run: |
@ -33,4 +33,4 @@ jobs:
echo "No CHANGELOG was modified."
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required."
false
fi
fi

View File

@ -20,16 +20,16 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: python
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3

View File

@ -10,6 +10,10 @@ jobs:
run_self:
runs-on: ubuntu-latest
name: Auto Assign Owners
permissions:
contents: read # to read changed files
issues: write # to read/write issue assignees
pull-requests: write # to read/write PR reviewers
# Don't fail tests if this workflow fails. Some pending issues:
# - https://github.com/dyladan/component-owners/issues/8
continue-on-error: true

2252
.github/workflows/core_contrib_test_0.yml vendored Normal file

File diff suppressed because it is too large Load Diff

20
.github/workflows/fossa.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: FOSSA scanning
on:
push:
branches:
- main
permissions:
contents: read
jobs:
fossa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
with:
api-key: ${{secrets.FOSSA_API_KEY}}
team: OpenTelemetry

16
.github/workflows/generate_workflows.py vendored Normal file
View File

@ -0,0 +1,16 @@
from pathlib import Path
from generate_workflows_lib import (
generate_contrib_workflow,
generate_lint_workflow,
generate_misc_workflow,
generate_test_workflow,
)
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
workflows_directory_path = Path(__file__).parent
generate_test_workflow(tox_ini_path, workflows_directory_path, "ubuntu-latest")
generate_lint_workflow(tox_ini_path, workflows_directory_path)
generate_misc_workflow(tox_ini_path, workflows_directory_path)
generate_contrib_workflow(workflows_directory_path)

View File

@ -0,0 +1,17 @@
from pathlib import Path
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
with open(
Path(__file__).parent.parent.parent.parent.joinpath("tox.ini")
) as tox_ini_file_0:
with open(
Path(__file__).parent.joinpath(
"src/generate_workflows_lib/tox.ini"
),
"w",
) as tox_ini_file_1:
tox_ini_file_1.write(tox_ini_file_0.read())

View File

@ -0,0 +1,32 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "generate-workflows-lib"
dynamic = ["version"]
description = "A library to generate workflows"
license = "Apache-2.0"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
dependencies = ["Jinja2", "tox"]
[tool.hatch.version]
path = "src/generate_workflows_lib/version.py"
[tool.hatch.build.targets.wheel.hooks.custom]

View File

@ -0,0 +1 @@
tox.ini

View File

@ -0,0 +1,236 @@
from collections import defaultdict
from pathlib import Path
from re import compile as re_compile
from jinja2 import Environment, FileSystemLoader
from tox.config.cli.parse import get_options
from tox.config.sets import CoreConfigSet
from tox.config.source.tox_ini import ToxIni
from tox.session.state import State
_tox_test_env_regex = re_compile(
r"(?P<python_version>py\w+)-test-"
r"(?P<name>[-\w]+\w)-?(?P<test_requirements>\d+)?"
)
_tox_lint_env_regex = re_compile(r"lint-(?P<name>[-\w]+)")
_tox_contrib_env_regex = re_compile(
r"py39-test-(?P<name>[-\w]+\w)-?(?P<contrib_requirements>\d+)?"
)
def get_tox_envs(tox_ini_path: Path) -> list:
tox_ini = ToxIni(tox_ini_path)
conf = State(get_options(), []).conf
tox_section = next(tox_ini.sections())
core_config_set = CoreConfigSet(
conf, tox_section, tox_ini_path.parent, tox_ini_path
)
(
core_config_set.loaders.extend(
tox_ini.get_loaders(
tox_section,
base=[],
override_map=defaultdict(list, {}),
conf=core_config_set,
)
)
)
return core_config_set.load("env_list")
def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
os_alias = {"ubuntu-latest": "Ubuntu", "windows-latest": "Windows"}
python_version_alias = {
"pypy3": "pypy-3.9",
"pypy310": "pypy-3.10",
"py39": "3.9",
"py310": "3.10",
"py311": "3.11",
"py312": "3.12",
"py313": "3.13",
}
test_job_datas = []
for operating_system in operating_systems:
for tox_env in tox_envs:
tox_test_env_match = _tox_test_env_regex.match(tox_env)
if tox_test_env_match is None:
continue
groups = tox_test_env_match.groupdict()
aliased_python_version = python_version_alias[
groups["python_version"]
]
tox_env = tox_test_env_match.string
test_requirements = groups["test_requirements"]
if test_requirements is None:
test_requirements = " "
else:
test_requirements = f"-{test_requirements} "
test_job_datas.append(
{
"name": f"{tox_env}_{operating_system}",
"ui_name": (
f"{groups['name']}"
f"{test_requirements}"
f"{aliased_python_version} "
f"{os_alias[operating_system]}"
),
"python_version": aliased_python_version,
"tox_env": tox_env,
"os": operating_system,
}
)
return test_job_datas
def get_lint_job_datas(tox_envs: list) -> list:
lint_job_datas = []
for tox_env in tox_envs:
tox_lint_env_match = _tox_lint_env_regex.match(tox_env)
if tox_lint_env_match is None:
continue
tox_env = tox_lint_env_match.string
lint_job_datas.append(
{
"name": f"{tox_env}",
"ui_name": f"{tox_lint_env_match.groupdict()['name']}",
"tox_env": tox_env,
}
)
return lint_job_datas
def get_contrib_job_datas(tox_envs: list) -> list:
contrib_job_datas = []
for tox_env in tox_envs:
tox_contrib_env_match = _tox_contrib_env_regex.match(tox_env)
if tox_contrib_env_match is None:
continue
groups = tox_contrib_env_match.groupdict()
tox_env = tox_contrib_env_match.string
contrib_requirements = groups["contrib_requirements"]
if contrib_requirements is None:
contrib_requirements = " "
else:
contrib_requirements = f"-{contrib_requirements} "
contrib_job_datas.append(
{
"ui_name": (f"{groups['name']}" f"{contrib_requirements}"),
"tox_env": tox_env,
}
)
return contrib_job_datas
def get_misc_job_datas(tox_envs: list) -> list:
misc_job_datas = []
_tox_benchmark_env_regex = re_compile(r"benchmark.+")
for tox_env in tox_envs:
if (
_tox_test_env_regex.match(tox_env) is not None
or _tox_lint_env_regex.match(tox_env) is not None
or _tox_contrib_env_regex.match(tox_env) is not None
or _tox_benchmark_env_regex.match(tox_env) is not None
):
continue
misc_job_datas.append(tox_env)
return misc_job_datas
def _generate_workflow(
job_datas: list, name: str, workflow_directory_path: Path, max_jobs=250
):
# Github seems to limit the amount of jobs in a workflow file, that is why
# they are split in groups of 250 per workflow file.
for file_number, job_datas in enumerate(
[
job_datas[index : index + max_jobs]
for index in range(0, len(job_datas), max_jobs)
]
):
with open(
workflow_directory_path.joinpath(f"{name}_{file_number}.yml"), "w"
) as test_yml_file:
test_yml_file.write(
Environment(loader=FileSystemLoader(Path(__file__).parent))
.get_template(f"{name}.yml.j2")
.render(job_datas=job_datas, file_number=file_number)
)
test_yml_file.write("\n")
def generate_test_workflow(
tox_ini_path: Path, workflow_directory_path: Path, *operating_systems
) -> None:
_generate_workflow(
get_test_job_datas(get_tox_envs(tox_ini_path), operating_systems),
"test",
workflow_directory_path,
)
def generate_lint_workflow(
tox_ini_path: Path,
workflow_directory_path: Path,
) -> None:
_generate_workflow(
get_lint_job_datas(get_tox_envs(tox_ini_path)),
"lint",
workflow_directory_path,
)
def generate_contrib_workflow(
workflow_directory_path: Path,
) -> None:
_generate_workflow(
get_contrib_job_datas(
get_tox_envs(Path(__file__).parent.joinpath("tox.ini"))
),
"core_contrib_test",
workflow_directory_path,
)
def generate_misc_workflow(
tox_ini_path: Path,
workflow_directory_path: Path,
) -> None:
_generate_workflow(
get_misc_job_datas(get_tox_envs(tox_ini_path)),
"misc",
workflow_directory_path,
)

View File

@ -0,0 +1,46 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Core Contrib Test {{ file_number }}
on:
workflow_call:
inputs:
CORE_REPO_SHA:
required: true
type: string
CONTRIB_REPO_SHA:
required: true
type: string
env:
CORE_REPO_SHA: ${% raw %}{{ inputs.CORE_REPO_SHA }}{% endraw %}
CONTRIB_REPO_SHA: ${% raw %}{{ inputs.CONTRIB_REPO_SHA }}{% endraw %}
PIP_EXISTS_ACTION: w
jobs:
{%- for job_data in job_datas %}
{{ job_data.tox_env }}:
name: {{ job_data.ui_name }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout contrib repo @ SHA - ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}
uses: actions/checkout@v4
with:
repository: open-telemetry/opentelemetry-python-contrib
ref: ${% raw %}{{ env.CONTRIB_REPO_SHA }}{% endraw %}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
architecture: "x64"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e {{ job_data.tox_env }} -- -ra
{%- endfor %}

View File

@ -0,0 +1,50 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Lint {{ file_number }}
on:
push:
branches-ignore:
- 'release/*'
pull_request:
concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
{%- for job_data in job_datas %}
{{ job_data.name }}:
name: {{ job_data.ui_name }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e {{ job_data.tox_env }}
{%- endfor %}

View File

@ -0,0 +1,87 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Misc {{ file_number }}
on:
push:
branches-ignore:
- 'release/*'
pull_request:
concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
{%- for job_data in job_datas %}
{{ job_data }}:
name: {{ job_data }}
runs-on: ubuntu-latest
timeout-minutes: 30
{%- if job_data == "generate-workflows" %}
if: |
!contains(github.event.pull_request.labels.*.name, 'Skip generate-workflows')
&& github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
{%- endif %}
{%- if job_data == "public-symbols-check" %}
if: |
!contains(github.event.pull_request.labels.*.name, 'Approve Public API check')
&& github.actor != 'opentelemetrybot' && github.event_name == 'pull_request'
{%- endif %}
{%- if job_data == "docs" %}
if: |
github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
{%- endif %}
steps:
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}
uses: actions/checkout@v4
{%- if job_data == "public-symbols-check" %}
with:
fetch-depth: 0
- name: Checkout main
run: git checkout main
- name: Pull origin
run: git pull --rebase=false origin main
- name: Checkout pull request
run: git checkout ${% raw %}{{ github.event.pull_request.head.sha }}{% endraw %}
{%- endif %}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e {{ job_data }}
{%- if job_data == "generate-workflows" %}
- name: Check workflows are up to date
run: git diff --exit-code || (echo 'Generated workflows are out of date, run "tox -e generate-workflows" and commit the changes in this PR.' && exit 1)
{%- endif %}
{%- if job_data == "generate" %}
- name: Check workflows are up to date
run: git diff --exit-code || (echo 'Generated code is out of date, run "tox -e generate" and commit the changes in this PR.' && exit 1)
{%- endif %}
{%- endfor %}

View File

@ -0,0 +1,55 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Test {{ file_number }}
on:
push:
branches-ignore:
- 'release/*'
pull_request:
concurrency:
group: ${% raw %}{{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
cancel-in-progress: true
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
{%- for job_data in job_datas %}
{{ job_data.name }}:
name: {{ job_data.ui_name }}
runs-on: {{ job_data.os }}
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}
uses: actions/checkout@v4
- name: Set up Python {{ job_data.python_version }}
uses: actions/setup-python@v5
with:
python-version: "{{ job_data.python_version }}"
- name: Install tox
run: pip install tox-uv
{%- if job_data.os == "windows-latest" %}
- name: Configure git to support long filenames
run: git config --system core.longpaths true
{%- endif %}
- name: Run tests
run: tox -e {{ job_data.tox_env }} -- -ra
{%- endfor %}

View File

@ -0,0 +1 @@
__version__ = "0.1.0"

View File

@ -1,123 +0,0 @@
name: Contrib Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
jobs:
instrumentations-0:
env:
# We use these variables to convert between tox and GHA version literals
py38: 3.8
py39: 3.9
py310: "3.10"
py311: "3.11"
pypy3: pypy-3.8
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
python-version: [py38, py39, py310, py311, pypy3]
package:
# Do not add more instrumentations here, add them in instrumentations_1.yml.
# The reason for this separation of instrumentations into more than one YAML file is
# the limit of jobs that can be run from a Github actions matrix:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
# "A matrix will generate a maximum of 256 jobs per workflow run. This limit applies
# to both GitHub-hosted and self-hosted runners."
- "aiohttp-client"
- "aiohttp-server"
- "aiopg"
- "aio-pika"
- "asgi"
- "asyncpg"
- "aws-lambda"
- "boto"
- "boto3sqs"
- "botocore"
- "cassandra"
- "celery"
- "confluent-kafka"
- "dbapi"
- "django"
- "elasticsearch"
- "falcon"
- "fastapi"
- "flask"
- "grpc"
- "httpx"
- "jinja2"
- "kafka-python"
- "logging"
- "mysql"
- "mysqlclient"
- "sio-pika"
- "psycopg2"
- "pymemcache"
- "pymongo"
- "pymysql"
- "pyramid"
- "redis"
- "remoulade"
- "requests"
- "sklearn"
- "sqlalchemy"
- "sqlite3"
- "starlette"
- "system-metrics"
- "tornado"
- "tortoiseorm"
os: [ubuntu-20.04]
exclude:
- python-version: py39
package: "sklearn"
- python-version: py310
package: "sklearn"
- python-version: py311
package: "sklearn"
- python-version: pypy3
package: "aiopg"
- python-version: pypy3
package: "asyncpg"
- python-version: pypy3
package: "boto"
- python-version: pypy3
package: "boto3sqs"
- python-version: pypy3
package: "botocore"
- python-version: pypy3
package: "psycopg2"
- python-version: pypy3
package: "remoulade"
- python-version: pypy3
package: "requests"
- python-version: pypy3
package: "sklearn"
- python-version: pypy3
package: "confluent-kafka"
- python-version: pypy3
package: "grpc"
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v4
with:
python-version: ${{ env[matrix.python-version] }}
- name: Install tox
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v1
with:
path: |
.tox
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json

View File

@ -1,62 +0,0 @@
name: Contrib Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
jobs:
instrumentations-1:
env:
# We use these variables to convert between tox and GHA version literals
py38: 3.8
py39: 3.9
py310: "3.10"
py311: "3.11"
pypy3: pypy-3.8
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
python-version: [py38, py39, py310, py311, pypy3]
package:
- "urllib"
- "urllib3"
- "wsgi"
- "distro"
- "richconsole"
- "psycopg"
- "prometheus-remote-write"
- "sdk-extension-aws"
- "propagator-aws-xray"
- "propagator-ot-trace"
- "resource-detector-container"
os: [ubuntu-20.04]
exclude:
- python-version: py311
package: "prometheus-remote-write"
- python-version: pypy3
package: "prometheus-remote-write"
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v4
with:
python-version: ${{ env[matrix.python-version] }}
- name: Install tox
run: pip install tox
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v1
with:
path: |
.tox
~/.cache/pip
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json

1264
.github/workflows/lint_0.yml vendored Normal file

File diff suppressed because it is too large Load Diff

192
.github/workflows/misc_0.yml vendored Normal file
View File

@ -0,0 +1,192 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Misc 0
on:
push:
branches-ignore:
- 'release/*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
spellcheck:
name: spellcheck
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e spellcheck
docker-tests:
name: docker-tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e docker-tests
docs:
name: docs
runs-on: ubuntu-latest
timeout-minutes: 30
if: |
github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e docs
generate:
name: generate
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e generate
- name: Check workflows are up to date
run: git diff --exit-code || (echo 'Generated code is out of date, run "tox -e generate" and commit the changes in this PR.' && exit 1)
generate-workflows:
name: generate-workflows
runs-on: ubuntu-latest
timeout-minutes: 30
if: |
!contains(github.event.pull_request.labels.*.name, 'Skip generate-workflows')
&& github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e generate-workflows
- name: Check workflows are up to date
run: git diff --exit-code || (echo 'Generated workflows are out of date, run "tox -e generate-workflows" and commit the changes in this PR.' && exit 1)
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e shellcheck
ruff:
name: ruff
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e ruff
typecheck:
name: typecheck
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e typecheck

47
.github/workflows/ossf-scorecard.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: OSSF Scorecard
on:
push:
branches:
- main
schedule:
- cron: "10 6 * * 1" # once a week
workflow_dispatch:
permissions: read-all
jobs:
analysis:
runs-on: ubuntu-latest
permissions:
# Needed for Code scanning upload
security-events: write
# Needed for GitHub OIDC token if publish_results is true
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
with:
results_file: results.sarif
results_format: sarif
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable
# uploads of run results in SARIF format to the repository Actions tab.
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: "Upload artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
with:
sarif_file: results.sarif

View File

@ -0,0 +1,121 @@
name: "[Package] Prepare patch release"
on:
workflow_dispatch:
inputs:
package:
type: choice
options:
- opentelemetry-propagator-aws-xray
- opentelemetry-resource-detector-azure
- opentelemetry-sdk-extension-aws
- opentelemetry-instrumentation-openai-v2
- opentelemetry-instrumentation-vertexai
- opentelemetry-instrumentation-google-genai
description: 'Package to be released'
required: true
run-name: "[Package][${{ inputs.package }}] Prepare patch release"
jobs:
prepare-patch-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify prerequisites
run: |
if [[ $GITHUB_REF_NAME != package-release/${{ inputs.package }}/v* ]]; then
echo this workflow should only be run against package-release/${{ inputs.package }}* branches, but is running on $GITHUB_REF_NAME
exit 1
fi
path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
changelog=$path/CHANGELOG.md
if [ ! -f $changelog ]; then
echo "missing $changelog file"
exit 1
fi
if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then
echo the $changelog is missing an \"Unreleased\" section
exit 1
fi
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})
version_file=$(find $path -type f -path "*version*.py")
file_count=$(echo "$version_file" | wc -l)
if [ "$file_count" -ne 1 ]; then
echo "Error: expected one version file, found $file_count"
echo "$version_file"
exit 1
fi
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
# 1.2.3 or 1.2.3rc1
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
next_version="$major.$minor.$((patch + 1))"
release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x"
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
# 0.1b1
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
next_version="$major.${minor}b$((patch + 1))"
release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx"
else
echo "unexpected version: '$version'"
exit 1
fi
if [[ $GITHUB_REF_NAME != $release_branch_name ]]; then
echo this workflow should only be run against $release_branch_name branch, but is running on $GITHUB_REF_NAME
exit 1
fi
echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV
echo "CHANGELOG=$changelog" >> $GITHUB_ENV
echo "VERSION_FILE=$version_file" >> $GITHUB_ENV
- name: Update version
run: |
# replace the version in the version file (1.2.3 -> 1.2.4)
sed -i -E "s/__version__\s*=\s*\"${VERSION}\"/__version__ = \"${NEXT_VERSION}\"/g" $VERSION_FILE
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
run: pip install tox
- name: run tox
run: tox -e generate
- name: Update the change log with the approximate release date
run: |
# the actual release date on main will be updated at the end of the release workflow
date=$(date "+%Y-%m-%d")
sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${NEXT_VERSION} ($date)/" ${CHANGELOG}
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Prepare patch release for ${PACKAGE_NAME} v${NEXT_VERSION}"
branch="opentelemetrybot/patch-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$GITHUB_REF_NAME] $message" \
--body "$message." \
--head $branch \
--base $GITHUB_REF_NAME

View File

@ -0,0 +1,198 @@
name: "[Package] Prepare release"
on:
workflow_dispatch:
inputs:
package:
type: choice
options:
- opentelemetry-propagator-aws-xray
- opentelemetry-resource-detector-azure
- opentelemetry-sdk-extension-aws
- opentelemetry-instrumentation-openai-v2
- opentelemetry-instrumentation-vertexai
- opentelemetry-instrumentation-google-genai
description: 'Package to be released'
required: true
run-name: "[Package][${{ inputs.package }}] Prepare release"
jobs:
prereqs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.verify.outputs.version }}
changelog: ${{ steps.verify.outputs.changelog }}
version_file: ${{ steps.verify.outputs.version_file }}
release_branch_name: ${{ steps.verify.outputs.release_branch_name }}
next_version: ${{ steps.verify.outputs.next_version }}
steps:
- uses: actions/checkout@v4
- id: verify
name: Verify prerequisites
run: |
if [[ $GITHUB_REF_NAME != main ]]; then
echo this workflow should only be run against main
exit 1
fi
path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
changelog=$path/CHANGELOG.md
if [ ! -f $changelog ]; then
echo "missing $changelog file"
exit 1
fi
if ! grep --quiet "^## Unreleased$" $changelog; then
echo the $changelog is missing an \"Unreleased\" section
exit 1
fi
version_dev=$(./scripts/eachdist.py version --package ${{ inputs.package }})
if [[ ! $version_dev =~ ^([0-9]+)\.([0-9]+)[\.|b]{1}([0-9]+).*.dev$ ]]; then
echo "unexpected version: $version"
exit 1
fi
version=${version_dev%.dev}
version_file=$(find $path -type f -path "*version*.py")
file_count=$(echo "$version_file" | wc -l)
if [ "$file_count" -ne 1 ]; then
echo "Error: expected one version file, found $file_count"
echo "$version_file"
exit 1
fi
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
# 1.2.3 or 1.2.3rc1
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x"
next_version="$major.$((minor + 1)).0"
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
# 0.1b1
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx"
next_version="$major.$((minor + 1))b0"
else
echo "unexpected version: '$version'"
exit 1
fi
echo "version=$version" >> $GITHUB_OUTPUT
echo "changelog=$changelog" >> $GITHUB_OUTPUT
echo "version_file=$version_file" >> $GITHUB_OUTPUT
echo "release_branch_name=$release_branch_name" >> $GITHUB_OUTPUT
echo "next_version=$next_version" >> $GITHUB_OUTPUT
create-pull-request-against-release-branch:
runs-on: ubuntu-latest
needs: prereqs
steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: |
echo "RELEASE_BRANCH_NAME=${{ needs.prereqs.outputs.release_branch_name }}" >> $GITHUB_ENV
echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV
echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV
echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV
- name: Create package release branch
run: |
git push origin HEAD:$RELEASE_BRANCH_NAME
- name: Update package version
run: |
# replace the version in the version file (1.2.3dev -> 1.2.3)
sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${VERSION}\"/g" $VERSION_FILE
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
run: pip install tox
- name: run tox
run: tox -e generate
- name: Update the change log with the approximate release date
run: |
date=$(date "+%Y-%m-%d")
sed -Ei "s/^## Unreleased$/## Version ${VERSION} ($date)/" ${CHANGELOG}
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against the release branch
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Prepare release for ${PACKAGE_NAME} v${VERSION}"
branch="opentelemetrybot/prepare-${RELEASE_BRANCH_NAME}"
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--head $branch \
--base $RELEASE_BRANCH_NAME
create-pull-request-against-main:
runs-on: ubuntu-latest
needs: prereqs
steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: |
echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV
echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV
echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV
echo "NEXT_VERSION=${{ needs.prereqs.outputs.next_version }}" >> $GITHUB_ENV
echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV
- name: Update version
run: |
# replace the version in the version file (1.2.3dev -> 1.3.3.dev)
sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${NEXT_VERSION}.dev\"/g" $VERSION_FILE
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
run: pip install tox
- name: run tox
run: tox -e generate
- name: Update the change log on main
run: |
# the actual release date on main will be updated at the end of the release workflow
date=$(date "+%Y-%m-%d")
sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${VERSION} ($date)/" ${CHANGELOG}
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against main
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Update ${PACKAGE_NAME} version to v${NEXT_VERSION}"
body="Update \`${PACKAGE_NAME}\` version to v\`${NEXT_VERSION}\`."
branch="opentelemetrybot/update-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main

160
.github/workflows/package-release.yml vendored Normal file
View File

@ -0,0 +1,160 @@
name: "[Package] Release"
on:
workflow_dispatch:
inputs:
package:
type: choice
options:
- opentelemetry-propagator-aws-xray
- opentelemetry-resource-detector-azure
- opentelemetry-sdk-extension-aws
- opentelemetry-instrumentation-openai-v2
- opentelemetry-instrumentation-vertexai
- opentelemetry-instrumentation-google-genai
description: 'Package to be released'
required: true
run-name: "[Package][${{ inputs.package }}] Release"
jobs:
release:
runs-on: ubuntu-latest
steps:
- run: |
if [[ $GITHUB_REF_NAME != package-release/${{ inputs.package }}* ]]; then
echo this workflow should only be run against package-release/${{ inputs.package }}* branches
exit 1
fi
- uses: actions/checkout@v4
- name: Set environment variables
run: |
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
if [[ $patch != 0 ]]; then
prior_version_when_patch="${major}.${minor}.$((patch - 1))"
fi
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
if [[ $patch != 0 ]]; then
prior_version_when_patch="${major}.${minor}b$((patch - 1))"
fi
else
echo "unexpected version: $version"
exit 1
fi
path=$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
echo "CHANGELOG=./$path/CHANGELOG.md" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_TAG=${{ inputs.package }}==$version" >> $GITHUB_ENV
echo "PRIOR_VERSION_WHEN_PATCH=$prior_version_when_patch" >> $GITHUB_ENV
# check out main branch to verify there won't be problems with merging the change log
# at the end of this workflow
- uses: actions/checkout@v4
with:
ref: main
- name: Check that change log update was merged to main
run: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
# not making a patch release
if ! grep --quiet "^## Version ${VERSION}" ${CHANGELOG}; then
echo the pull request generated by prepare-release-branch.yml needs to be merged first
exit 1
fi
fi
# back to the release branch
- uses: actions/checkout@v4
# next few steps publish to pypi
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Build wheels
run: ./scripts/build_a_package.sh
- name: Install twine
run: |
pip install twine
# The step below publishes to testpypi in order to catch any issues
# with the package configuration that would cause a failure to upload
# to pypi. One example of such a failure is if a classifier is
# rejected by pypi (e.g "3 - Beta"). This would cause a failure during the
# middle of the package upload causing the action to fail, and certain packages
# might have already been updated, this would be bad.
# EDIT: 5/31/2024 - TestPypi now requires a verified email. Commenting out as a temporary measure
# until we found TestPypi credentials.
# - name: Publish to TestPyPI
# env:
# TWINE_USERNAME: '__token__'
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
# run: |
# twine upload --repository testpypi --skip-existing --verbose dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
twine upload --skip-existing --verbose dist/*
- name: Generate release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/generate_release_notes.sh
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target $GITHUB_REF_NAME \
--title "${PACKAGE_NAME} ${VERSION}" \
--notes-file /tmp/release-notes.txt \
--discussion-category announcements \
$RELEASE_TAG
- uses: actions/checkout@v4
with:
ref: main
- name: Copy change log updates to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/merge_changelog_to_main.sh
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against main
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Copy changelog updates from $GITHUB_REF_NAME"
body="Copy changelog updates from \`$GITHUB_REF_NAME\`."
branch="opentelemetrybot/changelog-${GITHUB_REF_NAME//\//-}"
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if git diff --quiet; then
echo there are no updates needed to the change log on main, not creating pull request
exit 0 # success
fi
fi
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main

View File

@ -6,7 +6,7 @@ jobs:
prepare-patch-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x-0\.[0-9]+bx$ ]]; then
@ -40,17 +40,21 @@ jobs:
exit 1
fi
stable_version_prev="$stable_major_minor.$((stable_patch))"
unstable_version_prev="0.${unstable_minor}b$((unstable_patch))"
stable_version="$stable_major_minor.$((stable_patch + 1))"
unstable_version="0.${unstable_minor}b$((unstable_patch + 1))"
echo "STABLE_VERSION=$stable_version" >> $GITHUB_ENV
echo "UNSTABLE_VERSION=$unstable_version" >> $GITHUB_ENV
echo "STABLE_VERSION_PREV=$stable_version_prev" >> $GITHUB_ENV
echo "UNSTABLE_VERSION_PREV=$unstable_version_prev" >> $GITHUB_ENV
- name: Update version
run: .github/scripts/update-version.sh $STABLE_VERSION $UNSTABLE_VERSION
run: .github/scripts/update-version-patch.sh $STABLE_VERSION $UNSTABLE_VERSION $STABLE_VERSION_PREV $UNSTABLE_VERSION_PREV
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
@ -67,6 +71,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request
id: create_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@ -76,7 +81,15 @@ jobs:
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$GITHUB_REF_NAME] $message" \
pr_url=$(gh pr create --title "[$GITHUB_REF_NAME] $message" \
--body "$message." \
--head $branch \
--base $GITHUB_REF_NAME
--base $GITHUB_REF_NAME)
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
- name: Add prepare-release label to PR
if: steps.create_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_pr.outputs.pr_url }} --add-label "prepare-release"

View File

@ -10,7 +10,7 @@ jobs:
prereqs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Verify prerequisites
env:
@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
needs: prereqs
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Create release branch
env:
@ -77,7 +77,7 @@ jobs:
run: .github/scripts/update-version.sh $STABLE_VERSION $UNSTABLE_VERSION
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
@ -94,6 +94,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against the release branch
id: create_release_branch_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@ -103,16 +104,24 @@ jobs:
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
pr_url=$(gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--head $branch \
--base $RELEASE_BRANCH_NAME
--base $RELEASE_BRANCH_NAME)
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
- name: Add prepare-release label to PR
if: steps.create_release_branch_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_release_branch_pr.outputs.pr_url }} --add-label "prepare-release"
create-pull-request-against-main:
runs-on: ubuntu-latest
needs: prereqs
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set environment variables
env:
@ -161,7 +170,7 @@ jobs:
run: .github/scripts/update-version.sh $STABLE_NEXT_VERSION $UNSTABLE_NEXT_VERSION
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
@ -179,6 +188,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against main
id: create_main_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
@ -189,7 +199,15 @@ jobs:
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
pr_url=$(gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main
--base main)
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
- name: Add prepare-release label to PR
if: steps.create_main_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_main_pr.outputs.pr_url }} --add-label "prepare-release"

View File

@ -1,31 +0,0 @@
name: Publish a Package from Tag
on:
push:
tags:
- 'opentelemetry-*==[1-9]*.*'
jobs:
publish-a-package:
name: Publish package from tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
- name: Log tag that triggered publish workflow
run: echo "Attempting to publish package from tag $GITHUB_REF"
- name: Build wheel for tag
run: ./scripts/build_a_package.sh
- name: Install twine
run: |
pip install twine
# We don't need to publish to TestPyPI because we only publish 1 package.
# If it fails no other work needs to be reversed.
- name: Publish to PyPI
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
twine upload --skip-existing --verbose dist/*

View File

@ -12,7 +12,7 @@ jobs:
exit 1
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set environment variables
run: |
@ -42,7 +42,7 @@ jobs:
echo "STABLE_VERSION=$stable_version" >> $GITHUB_ENV
echo "UNSTABLE_VERSION=$unstable_version" >> $GITHUB_ENV
echo "CHANGELOG=CHANGELOG.md" >> $GITHUB_ENV
echo "PRIOR_VERSION_WHEN_PATCH=$prior_version_when_patch" >> $GITHUB_ENV
- run: |
@ -56,17 +56,17 @@ jobs:
# check out main branch to verify there won't be problems with merging the change log
# at the end of this workflow
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main
# back to the release branch
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# next few steps publish to pypi
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'
- name: Build wheels
run: ./scripts/build.sh
@ -81,6 +81,7 @@ jobs:
# rejected by pypi (e.g "3 - Beta"). This would cause a failure during the
# middle of the package upload causing the action to fail, and certain packages
# might have already been updated, this would be bad.
- name: Publish to TestPyPI
env:
TWINE_USERNAME: '__token__'
@ -99,23 +100,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# conditional block not indented because of the heredoc
if [[ ! -z $PRIOR_VERSION_WHEN_PATCH ]]; then
cat > /tmp/release-notes.txt << EOF
This is a patch release on the previous $PRIOR_VERSION_WHEN_PATCH release, fixing the issue(s) below.
EOF
fi
# CHANGELOG_SECTION.md is also used at the end of the release workflow
# for copying the change log updates to main
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;/^## Version /q;p" CHANGELOG.md \
> /tmp/CHANGELOG_SECTION.md
# the complex perl regex is needed because markdown docs render newlines as soft wraps
# while release notes render them as line breaks
perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' /tmp/CHANGELOG_SECTION.md \
>> /tmp/release-notes.txt
echo "VERSION=${STABLE_VERSION}\/${UNSTABLE_VERSION}" >> $GITHUB_ENV
./scripts/generate_release_notes.sh
- name: Create GitHub release
env:
@ -127,79 +113,8 @@ jobs:
--discussion-category announcements \
v$UNSTABLE_VERSION
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# the step below is creating a pull request against main
ref: main
- name: Copy change log updates to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
# this was not a patch release, so the version exists already in the CHANGELOG.md
# update the release date
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
sed -Ei "s/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} .*/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
# the entries are copied over from the release branch to support workflows
# where change log entries may be updated after preparing the release branch
# copy the portion above the release, up to and including the heading
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md
# copy the release notes
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
# copy the portion below the release
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \
>> /tmp/CHANGELOG.md
# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md
else
# this was a patch release, so the version does not exist already in the CHANGELOG.md
# copy the portion above the top-most release, not including the heading
sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md
# add the heading
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
echo "## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} ($date)" >> /tmp/CHANGELOG.md
# copy the release notes
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
# copy the portion starting from the top-most release
sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md
# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md
fi
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request against main
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Copy change log updates from $GITHUB_REF_NAME"
body="Copy log updates from \`$GITHUB_REF_NAME\`."
branch="opentelemetrybot/copy-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if git diff --quiet; then
echo there are no updates needed to the change log on main, not creating pull request
exit 0 # success
fi
fi
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main

View File

@ -1,43 +0,0 @@
name: Contrib Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
jobs:
misc:
strategy:
fail-fast: false
matrix:
tox-environment: [ "docker-tests", "spellcheck", "lint", "docs", "generate" ]
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-20.04
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install tox
run: pip install tox
- name: Install libsnappy-dev
if: ${{ matrix.tox-environment == 'lint' }}
run: sudo apt-get install -y libsnappy-dev
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v1
with:
path: |
.tox
~/.cache/pip
key: v7-misc-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt', 'gen-requirements.txt', 'docs-requirements.txt') }}
- name: run tox
run: tox -e ${{ matrix.tox-environment }}
- name: Ensure generated code is up to date
if: matrix.tox-environment == 'generate'
run: git diff --exit-code || (echo 'Generated code is out of date, please run "tox -e generate" and commit the changes in this PR.' && exit 1)

4779
.github/workflows/test_0.yml vendored Normal file

File diff suppressed because it is too large Load Diff

4779
.github/workflows/test_1.yml vendored Normal file

File diff suppressed because it is too large Load Diff

960
.github/workflows/test_2.yml vendored Normal file
View File

@ -0,0 +1,960 @@
# Do not edit this file.
# This file is generated automatically by executing tox -e generate-workflows
name: Test 2
on:
push:
branches-ignore:
- 'release/*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
py312-test-instrumentation-aio-pika-1_ubuntu-latest:
name: instrumentation-aio-pika-1 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-aio-pika-1 -- -ra
py312-test-instrumentation-aio-pika-2_ubuntu-latest:
name: instrumentation-aio-pika-2 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-aio-pika-2 -- -ra
py312-test-instrumentation-aio-pika-3_ubuntu-latest:
name: instrumentation-aio-pika-3 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-aio-pika-3 -- -ra
py313-test-instrumentation-aio-pika-0_ubuntu-latest:
name: instrumentation-aio-pika-0 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-aio-pika-0 -- -ra
py313-test-instrumentation-aio-pika-1_ubuntu-latest:
name: instrumentation-aio-pika-1 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-aio-pika-1 -- -ra
py313-test-instrumentation-aio-pika-2_ubuntu-latest:
name: instrumentation-aio-pika-2 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-aio-pika-2 -- -ra
py313-test-instrumentation-aio-pika-3_ubuntu-latest:
name: instrumentation-aio-pika-3 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-aio-pika-3 -- -ra
pypy3-test-instrumentation-aio-pika-0_ubuntu-latest:
name: instrumentation-aio-pika-0 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-aio-pika-0 -- -ra
pypy3-test-instrumentation-aio-pika-1_ubuntu-latest:
name: instrumentation-aio-pika-1 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-aio-pika-1 -- -ra
pypy3-test-instrumentation-aio-pika-2_ubuntu-latest:
name: instrumentation-aio-pika-2 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-aio-pika-2 -- -ra
pypy3-test-instrumentation-aio-pika-3_ubuntu-latest:
name: instrumentation-aio-pika-3 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-aio-pika-3 -- -ra
py39-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-aiokafka -- -ra
py310-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-aiokafka -- -ra
py311-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-aiokafka -- -ra
py312-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-aiokafka -- -ra
py313-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-aiokafka -- -ra
pypy3-test-instrumentation-aiokafka_ubuntu-latest:
name: instrumentation-aiokafka pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-aiokafka -- -ra
py39-test-instrumentation-kafka-python_ubuntu-latest:
name: instrumentation-kafka-python 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-kafka-python -- -ra
py310-test-instrumentation-kafka-python_ubuntu-latest:
name: instrumentation-kafka-python 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-kafka-python -- -ra
py311-test-instrumentation-kafka-python_ubuntu-latest:
name: instrumentation-kafka-python 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-kafka-python -- -ra
py39-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-kafka-pythonng -- -ra
py310-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-kafka-pythonng -- -ra
py311-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-kafka-pythonng -- -ra
py312-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-kafka-pythonng -- -ra
py313-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-kafka-pythonng -- -ra
pypy3-test-instrumentation-kafka-python_ubuntu-latest:
name: instrumentation-kafka-python pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-kafka-python -- -ra
pypy3-test-instrumentation-kafka-pythonng_ubuntu-latest:
name: instrumentation-kafka-pythonng pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-kafka-pythonng -- -ra
py39-test-instrumentation-confluent-kafka_ubuntu-latest:
name: instrumentation-confluent-kafka 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-confluent-kafka -- -ra
py310-test-instrumentation-confluent-kafka_ubuntu-latest:
name: instrumentation-confluent-kafka 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-confluent-kafka -- -ra
py311-test-instrumentation-confluent-kafka_ubuntu-latest:
name: instrumentation-confluent-kafka 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-confluent-kafka -- -ra
py312-test-instrumentation-confluent-kafka_ubuntu-latest:
name: instrumentation-confluent-kafka 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-confluent-kafka -- -ra
py313-test-instrumentation-confluent-kafka_ubuntu-latest:
name: instrumentation-confluent-kafka 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-confluent-kafka -- -ra
py39-test-instrumentation-asyncio_ubuntu-latest:
name: instrumentation-asyncio 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-asyncio -- -ra
py310-test-instrumentation-asyncio_ubuntu-latest:
name: instrumentation-asyncio 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-asyncio -- -ra
py311-test-instrumentation-asyncio_ubuntu-latest:
name: instrumentation-asyncio 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-asyncio -- -ra
py312-test-instrumentation-asyncio_ubuntu-latest:
name: instrumentation-asyncio 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-asyncio -- -ra
py313-test-instrumentation-asyncio_ubuntu-latest:
name: instrumentation-asyncio 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-asyncio -- -ra
py39-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-cassandra -- -ra
py310-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-cassandra -- -ra
py311-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-cassandra -- -ra
py312-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-cassandra -- -ra
py313-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-cassandra -- -ra
pypy3-test-instrumentation-cassandra_ubuntu-latest:
name: instrumentation-cassandra pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-cassandra -- -ra
py39-test-processor-baggage_ubuntu-latest:
name: processor-baggage 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-processor-baggage -- -ra
py310-test-processor-baggage_ubuntu-latest:
name: processor-baggage 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-processor-baggage -- -ra
py311-test-processor-baggage_ubuntu-latest:
name: processor-baggage 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-processor-baggage -- -ra
py312-test-processor-baggage_ubuntu-latest:
name: processor-baggage 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-processor-baggage -- -ra
py313-test-processor-baggage_ubuntu-latest:
name: processor-baggage 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-processor-baggage -- -ra
pypy3-test-processor-baggage_ubuntu-latest:
name: processor-baggage pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-processor-baggage -- -ra

3
.gitignore vendored
View File

@ -58,3 +58,6 @@ _build/
# mypy
.mypy_cache/
target
# Benchmark result files
*-benchmark.json

View File

@ -1,19 +0,0 @@
[settings]
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=79
profile=black
; 3 stands for Vertical Hanging Indent, e.g.
; from third_party import (
; lib1,
; lib2,
; lib3,
; )
; docs: https://github.com/timothycrosley/isort#multi-line-output-modes
multi_line_output=3
skip=target
skip_glob=**/gen/*,.venv*/*,venv*/*,.tox/*
known_first_party=opentelemetry
known_third_party=psutil,pytest,redis,redis_opentracing

15
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,15 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.9
hooks:
# Run the linter.
- id: ruff
args: ["--fix", "--show-fixes"]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.6.0
hooks:
- id: uv-lock

View File

@ -7,7 +7,7 @@ extension-pkg-whitelist=cassandra
# Add list of files or directories to be excluded. They should be base names, not
# paths.
ignore=CVS,gen,Dockerfile,docker-compose.yml,README.md,requirements.txt,docs
ignore=CVS,gen,Dockerfile,docker-compose.yml,README.md,requirements.txt,docs,.venv,site-packages,.tox
# Add files or directories matching the regex patterns to be excluded. The
# regex matches against base names, not paths.
@ -45,6 +45,9 @@ suggestion-mode=yes
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
# Run python dependant checks considering the baseline version
py-version=3.9
[MESSAGES CONTROL]
@ -81,6 +84,7 @@ disable=missing-docstring,
missing-module-docstring, # temp-pylint-upgrade
import-error, # needed as a workaround as reported here: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/290
cyclic-import,
not-context-manager
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@ -491,4 +495,4 @@ min-public-methods=2
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception".
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception

View File

@ -6,9 +6,10 @@ sphinx:
configuration: docs/conf.py
build:
image: latest
os: "ubuntu-24.04"
tools:
python: "3.11"
python:
version: 3.8
install:
- requirements: docs-requirements.txt
- requirements: rtd-requirements.txt

View File

@ -5,12 +5,574 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
> [!NOTE]
> The following components are released independently and maintain individual CHANGELOG files.
> Use [this search for a list of all CHANGELOG.md files in this repo](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-python-contrib+path%3A**%2FCHANGELOG.md&type=code).
## Unreleased
## Version 1.35.0/0.56b0 (2025-07-11)
### Added
- `opentelemetry-instrumentation-pika` Added instrumentation for All `SelectConnection` adapters
([#3584](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3584))
- `opentelemetry-instrumentation-tornado` Add support for `WebSocketHandler` instrumentation
([#3498](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3498))
- `opentelemetry-util-http` Added support for redacting specific url query string values and url credentials in instrumentations
([#3508](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3508))
- `opentelemetry-instrumentation-pymongo` `aggregate` and `getMore` capture statements support
([#3601](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3601))
### Fixed
- `opentelemetry-instrumentation-asgi`: fix excluded_urls in instrumentation-asgi
([#3567](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3567))
- `opentelemetry-resource-detector-containerid`: make it more quiet on platforms without cgroups
([#3579](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3579))
## Version 1.34.0/0.55b0 (2025-06-04)
### Fixed
- `opentelemetry-instrumentation-system-metrics`: fix loading on Google Cloud Run
([#3533](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3533))
- `opentelemetry-instrumentation-fastapi`: fix wrapping of middlewares
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
- `opentelemetry-instrumentation-starlette` Remove max version constraint on starlette
([#3456](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3456))
- `opentelemetry-instrumentation-starlette` Fix memory leak and double middleware
([#3529](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3529))
- `opentelemetry-instrumentation-urllib3`: proper bucket boundaries in stable semconv http duration metrics
([#3518](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3518))
- `opentelemetry-instrumentation-urllib`: proper bucket boundaries in stable semconv http duration metrics
([#3519](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3519))
- `opentelemetry-instrumentation-falcon`: proper bucket boundaries in stable semconv http duration
([#3525](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3525))
- `opentelemetry-instrumentation-wsgi`: add explicit http duration buckets for stable semconv
([#3527](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3527))
- `opentelemetry-instrumentation-asgi`: add explicit http duration buckets for stable semconv
([#3526](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3526))
- `opentelemetry-instrumentation-flask`: proper bucket boundaries in stable semconv http duration
([#3523](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3523))
- `opentelemetry-instrumentation-django`: proper bucket boundaries in stable semconv http duration
([#3524](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3524))
- `opentelemetry-instrumentation-grpc`: support non-list interceptors
([#3520](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3520))
- `opentelemetry-instrumentation-botocore` Ensure spans end on early stream closure for Bedrock Streaming APIs
([#3481](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3481))
- `opentelemetry-instrumentation-sqlalchemy` Respect suppress_instrumentation functionality
([#3477](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3477))
- `opentelemetry-instrumentation-botocore`: fix handling of tool input in Bedrock ConverseStream
([#3544](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3544))
- `opentelemetry-instrumentation-botocore` Add type check when extracting tool use from Bedrock request message content
([#3548](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3548))
- `opentelemetry-instrumentation-dbapi` Respect suppress_instrumentation functionality ([#3460](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3460))
- `opentelemetry-resource-detector-container` Correctly parse container id when using systemd and cgroupsv1
([#3429](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3429))
### Breaking changes
- `opentelemetry-instrumentation-botocore` Use `cloud.region` instead of `aws.region` span attribute as per semantic conventions.
([#3474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3474))
- `opentelemetry-instrumentation-fastapi`: Drop support for FastAPI versions earlier than `0.92`
([#3012](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3012))
- `opentelemetry-resource-detector-container`: rename package name to `opentelemetry-resource-detector-containerid`
([#3536](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3536))
### Added
- `opentelemetry-instrumentation-aiohttp-client` Add support for HTTP metrics
([#3517](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3517))
- `opentelemetry-instrumentation-httpx` Add support for HTTP metrics
([#3513](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3513))
- `opentelemetry-instrumentation` Allow re-raising exception when instrumentation fails
([#3545](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3545))
- `opentelemetry-instrumentation-aiokafka` Add instrumentation of `consumer.getmany` (batch)
([#3257](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3257))
### Deprecated
- Drop support for Python 3.8, bump baseline to Python 3.9.
([#3399](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3399))
## Version 1.33.0/0.54b0 (2025-05-09)
### Added
- `opentelemetry-instrumentation-requests` Support explicit_bucket_boundaries_advisory in duration metrics
([#3464](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3464))
- `opentelemetry-instrumentation-redis` Add support for redis client-specific instrumentation.
([#3143](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3143))
### Fixed
- `opentelemetry-instrumentation` Catch `ModuleNotFoundError` when the library is not installed
and log as debug instead of exception
([#3423](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3423))
- `opentelemetry-instrumentation-asyncio` Fix duplicate instrumentation
([#3383](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3383))
- `opentelemetry-instrumentation-botocore` Add GenAI instrumentation for additional Bedrock models for InvokeModel API
([#3419](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3419))
- `opentelemetry-instrumentation` don't print duplicated conflict log error message
([#3432](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3432))
- `opentelemetry-instrumentation-grpc` Check for None result in gRPC
([#3380](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3381))
- `opentelemetry-instrumentation-[asynclick/click]` Add missing opentelemetry-instrumentation dep
([#3447](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3447))
- `opentelemetry-instrumentation-botocore` Capture server attributes for botocore API calls
([#3448](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3448))
## Version 1.32.0/0.53b0 (2025-04-10)
### Added
- `opentelemetry-instrumentation-asyncclick`: new instrumentation to trace asyncclick commands
([#3319](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3319))
- `opentelemetry-instrumentation-botocore` Add support for GenAI tool events using Amazon Nova models and `InvokeModel*` APIs
([#3385](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3385))
- `opentelemetry-instrumentation` Make auto instrumentation use the same dependency resolver as manual instrumentation does
([#3202](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3202))
### Fixed
- `opentelemetry-instrumentation` Fix client address is set to server address in new semconv
([#3354](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3354))
- `opentelemetry-instrumentation-dbapi`, `opentelemetry-instrumentation-django`,
`opentelemetry-instrumentation-sqlalchemy`: Fix sqlcomment for non string query and composable object.
([#3113](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3113))
- `opentelemetry-instrumentation-grpc` Fix error when using gprc versions <= 1.50.0 with unix sockets.
([[#3393](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3393)])
- `opentelemetry-instrumentation-asyncio` Fix duplicate instrumentation.
([[#3383](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3383)])
- `opentelemetry-instrumentation-aiokafka` Fix send_and_wait method no headers kwargs error.
([[#3332](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3332)])
## Version 1.31.0/0.52b0 (2025-03-12)
### Added
- `opentelemetry-instrumentation-openai-v2` Update doc for OpenAI Instrumentation to support OpenAI Compatible Platforms
([#3279](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3279))
- `opentelemetry-instrumentation-system-metrics` Add `process` metrics and deprecated `process.runtime` prefixed ones
([#3250](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3250))
- `opentelemetry-instrumentation-botocore` Add support for GenAI user events and lazy initialize tracer
([#3258](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3258))
- `opentelemetry-instrumentation-botocore` Add support for GenAI system events
([#3266](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3266))
- `opentelemetry-instrumentation-botocore` Add support for GenAI choice events
([#3275](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3275))
- `opentelemetry-instrumentation-botocore` Add support for GenAI tool events
([#3302](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3302))
- `opentelemetry-instrumentation-botocore` Add support for GenAI metrics
([#3326](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3326))
- `opentelemetry-instrumentation` make it simpler to initialize auto-instrumentation programmatically
([#3273](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3273))
- Add `opentelemetry-instrumentation-vertexai>=2.0b0` to `opentelemetry-bootstrap`
([#3307](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3307))
- Loosen `opentelemetry-instrumentation-starlette[instruments]` specifier
([#3304](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3304))
### Fixed
- `opentelemetry-instrumentation-redis` Add missing entry in doc string for `def _instrument`
([#3247](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3247))
- `opentelemetry-instrumentation-botocore` sns-extension: Change destination name attribute
to match topic ARN and redact phone number from attributes
([#3249](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3249))
- `opentelemetry-instrumentation-asyncpg` Fix fallback for empty queries.
([#3253](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3253))
- `opentelemetry-instrumentation` Fix a traceback in sqlcommenter when psycopg connection pooling is enabled.
([#3309](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3309))
- `opentelemetry-instrumentation-threading` Fix broken context typehints
([#3322](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3322))
- `opentelemetry-instrumentation-requests` always record span status code in duration metric
([#3323](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3323))
## Version 1.30.0/0.51b0 (2025-02-03)
### Added
- `opentelemetry-instrumentation-confluent-kafka` Add support for confluent-kafka <=2.7.0
([#3100](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3100))
- Add support to database stability opt-in in `_semconv` utilities and add tests
([#3111](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3111))
- `opentelemetry-instrumentation-urllib` Add `py.typed` file to enable PEP 561
([#3131](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3131))
- `opentelemetry-opentelemetry-pymongo` Add `py.typed` file to enable PEP 561
([#3136](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3136))
- `opentelemetry-opentelemetry-requests` Add `py.typed` file to enable PEP 561
([#3135](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3135))
- `opentelemetry-instrumentation-system-metrics` Add `py.typed` file to enable PEP 561
([#3132](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3132))
- `opentelemetry-opentelemetry-sqlite3` Add `py.typed` file to enable PEP 561
([#3133](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3133))
- `opentelemetry-instrumentation-falcon` add support version to v4
([#3086](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3086))
- `opentelemetry-instrumentation-falcon` Implement new HTTP semantic convention opt-in for Falcon
([#2790](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2790))
- `opentelemetry-instrumentation-wsgi` always record span status code to have it available in metrics
([#3148](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3148))
- add support to Python 3.13
([#3134](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3134))
- `opentelemetry-opentelemetry-wsgi` Add `py.typed` file to enable PEP 561
([#3129](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3129))
- `opentelemetry-util-http` Add `py.typed` file to enable PEP 561
([#3127](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3127))
- `opentelemetry-instrumentation-psycopg2` Add support for psycopg2-binary
([#3186](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3186))
- `opentelemetry-opentelemetry-botocore` Add basic support for GenAI attributes for AWS Bedrock Converse API
([#3161](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3161))
- `opentelemetry-opentelemetry-botocore` Add basic support for GenAI attributes for AWS Bedrock InvokeModel API
([#3200](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3200))
- `opentelemetry-opentelemetry-botocore` Add basic support for GenAI attributes for AWS Bedrock ConverseStream API
([#3204](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3204))
- `opentelemetry-opentelemetry-botocore` Add basic support for GenAI attributes for AWS Bedrock InvokeModelWithStreamResponse API
([#3206](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3206))
- `opentelemetry-instrumentation-pymssql` Add pymssql instrumentation
([#394](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/394))
- `opentelemetry-instrumentation-mysql` Add sqlcommenter support
([#3163](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3163))
### Fixed
- `opentelemetry-instrumentation-httpx` Fix `RequestInfo`/`ResponseInfo` type hints
([#3105](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3105))
- `opentelemetry-instrumentation-dbapi` Move `TracedCursorProxy` and `TracedConnectionProxy` to the module level
([#3068](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3068))
- `opentelemetry-instrumentation-click` Disable tracing of well-known server click commands
([#3174](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3174))
- `opentelemetry-instrumentation` Fix `get_dist_dependency_conflicts` if no distribution requires
([#3168](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3168))
### Breaking changes
- `opentelemetry-exporter-prometheus-remote-write` updated protobuf required version from 4.21 to 5.26 and regenerated protobufs
([#3219](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3219))
- `opentelemetry-instrumentation-sqlalchemy` including sqlcomment in `db.statement` span attribute value is now opt-in
([#3112](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3112))
- `opentelemetry-instrumentation-dbapi` including sqlcomment in `db.statement` span attribute value is now opt-in
([#3115](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3115))
- `opentelemetry-instrumentation-psycopg2`, `opentelemetry-instrumentation-psycopg`, `opentelemetry-instrumentation-mysqlclient`, `opentelemetry-instrumentation-pymysql`: including sqlcomment in `db.statement` span attribute value is now opt-in
([#3121](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3121))
## Version 1.29.0/0.50b0 (2024-12-11)
### Added
- `opentelemetry-instrumentation-starlette` Add type hints to the instrumentation
([#3045](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3045))
- `opentelemetry-distro` default to OTLP log exporter.
([#3042](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3042))
- `opentelemetry-instrumentation-sqlalchemy` Update unit tests to run with SQLALchemy 2
([#2976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2976))
- Add `opentelemetry-instrumentation-openai-v2` to `opentelemetry-bootstrap`
([#2996](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2996))
- `opentelemetry-instrumentation-sqlalchemy` Add sqlcomment to `db.statement` attribute
([#2937](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2937))
- `opentelemetry-instrumentation-dbapi` Add sqlcomment to `db.statement` attribute
([#2935](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2935))
- `opentelemetry-instrumentation-dbapi` instrument_connection accepts optional connect_module
([#3027](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3027))
- `opentelemetry-instrumentation-mysqlclient` Add sqlcommenter support
([#2941](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2941))
- `opentelemetry-instrumentation-pymysql` Add sqlcommenter support
([#2942](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2942))
- `opentelemetry-instrumentation-click`: new instrumentation to trace click commands
([#2994](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2994))
### Fixed
- `opentelemetry-instrumentation-starlette`: Retrieve `meter_provider` key instead of `_meter_provider` on `_instrument`
([#3048](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3048))
- `opentelemetry-instrumentation-httpx`: instrument_client is a static method again
([#3003](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3003))
- `opentelemetry-instrumentation-system_metrics`: fix callbacks reading wrong config
([#3025](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3025))
- `opentelemetry-instrumentation-httpx`: Check if mount transport is none before wrap it
([#3022](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3022))
- Replace all instrumentor unit test `assertEqualSpanInstrumentationInfo` calls with `assertEqualSpanInstrumentationScope` calls
([#3037](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3037))
- `opentelemetry-instrumentation-sqlalchemy` Fixes engines from `sqlalchemy.engine_from_config` not being fully instrumented
([#2816](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2816))
- `opentelemetry-instrumentation-sqlalchemy`: Fix a remaining memory leak in EngineTracer
([#3053](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3053))
- `opentelemetry-instrumentation-sqlite3`: Update documentation on explicit cursor support of tracing
([#3088](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3088))
### Breaking changes
- `opentelemetry-instrumentation-sqlalchemy` teach instruments version
([#2971](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2971))
- Drop `opentelemetry-instrumentation-test` package from default instrumentation list
([#2969](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2969))
- `opentelemetry-instrumentation-httpx`: remove private unused `_InstrumentedClient` and `_InstrumentedAsyncClient` classes
([#3036](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3036))
## Version 1.28.0/0.49b0 (2024-11-05)
### Added
- `opentelemetry-instrumentation-openai-v2` Instrumentation for OpenAI >= 0.27.0
([#2759](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2759))
- `opentelemetry-instrumentation-fastapi` Add autoinstrumentation mechanism tests.
([#2860](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2860))
- `opentelemetry-instrumentation-aiokafka` Add instrumentor and auto instrumentation support for aiokafka
([#2082](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2082))
- `opentelemetry-instrumentation-redis` Add additional attributes for methods create_index and search, rename those spans
([#2635](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2635))
- `opentelemetry-instrumentation` Add support for string based dotted module paths in unwrap
([#2919](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2919))
### Fixed
- `opentelemetry-instrumentation-aiokafka` Wrap `AIOKafkaConsumer.getone()` instead of `AIOKafkaConsumer.__anext__`
([#2874](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2874))
- `opentelemetry-instrumentation-confluent-kafka` Fix to allow `topic` to be extracted from `kwargs` in `produce()`
([#2901])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2901)
- `opentelemetry-instrumentation-system-metrics` Update metric units to conform to UCUM conventions.
([#2922](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2922))
- `opentelemetry-instrumentation-celery` Don't detach context without a None token
([#2927](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2927))
- `opentelemetry-exporter-prometheus-remote-write`: sort labels before exporting
([#2940](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2940))
- `opentelemetry-instrumentation-dbapi` sqlcommenter key values created from PostgreSQL, MySQL systems
([#2897](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2897))
- `opentelemetry-instrumentation-system-metrics`: don't report open file descriptors on Windows
([#2946](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2946))
### Breaking changes
- Deprecation of pkg_resource in favor of importlib.metadata
([#2871](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2871))
- `opentelemetry-instrumentation` Don't fail distro loading if instrumentor raises ImportError, instead skip them
([#2923](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2923))
- `opentelemetry-instrumentation-httpx` Rewrote instrumentation to use wrapt instead of subclassing
([#2909](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2909))
## Version 1.27.0/0.48b0 (2024-08-28)
### Added
- `opentelemetry-instrumentation-kafka-python` Instrument temporary fork, kafka-python-ng inside kafka-python's instrumentation
([#2537](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2537))
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-fastapi` Add ability to disable internal HTTP send and receive spans
([#2802](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2802))
- `opentelemetry-instrumentation-asgi` Add fallback decoding for ASGI headers
([#2837](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2837))
### Breaking changes
- `opentelemetry-bootstrap` Remove `opentelemetry-instrumentation-aws-lambda` from the defaults instrumentations
([#2786](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2786))
### Fixed
- `opentelemetry-instrumentation-httpx` fix handling of async hooks
([#2823](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2823))
- `opentelemetry-instrumentation-system-metrics` fix `process.runtime.cpu.utilization` values to be shown in range of 0 to 1
([#2812](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2812))
- `opentelemetry-instrumentation-fastapi` fix `fastapi` auto-instrumentation by removing `fastapi-slim` support, `fastapi-slim` itself is discontinued from maintainers
([#2783](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2783))
- `opentelemetry-instrumentation-aws-lambda` Avoid exception when a handler is not present.
([#2750](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2750))
- `opentelemetry-instrumentation-django` Fix regression - `http.target` re-added back to old semconv duration metrics
([#2746](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2746))
- `opentelemetry-instrumentation-asgi` do not set `url.full` attribute for server spans
([#2735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2735))
- `opentelemetry-instrumentation-grpc` Fixes the issue with the gRPC instrumentation not working with the 1.63.0 and higher version of gRPC
([#2483](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2484))
- `opentelemetry-instrumentation-aws-lambda` Fixing w3c baggage support
([#2589](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2589))
- `opentelemetry-instrumentation-celery` propagates baggage
([#2385](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2385))
- `opentelemetry-instrumentation-asyncio` Fixes async generator coroutines not being awaited
([#2792](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2792))
- `opentelemetry-instrumentation-tornado` Handle http client exception and record exception info into span
([#2563](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2563))
- `opentelemetry-instrumentation` fix `http.host` new http semantic convention mapping to depend on `kind` of span
([#2814](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2814))
- `opentelemetry-instrumentation` Fix the description of `http.server.duration` and `http.server.request.duration`
([#2753](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2753))
- `opentelemetry-instrumentation-grpc` Fix grpc supported version
([#2845](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2845))
- `opentelemetry-instrumentation-asyncio` fix `AttributeError` in
`AsyncioInstrumentor.trace_to_thread` when `func` is a `functools.partial` instance
([#2911](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2911))
## Version 1.26.0/0.47b0 (2024-07-23)
### Added
- `opentelemetry-instrumentation-flask` Add `http.route` and `http.target` to metric attributes
([#2621](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2621))
- `opentelemetry-instrumentation-aws-lambda` Enable global propagator for AWS instrumentation
([#2708](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2708))
- `opentelemetry-instrumentation-sklearn` Deprecated the sklearn instrumentation
([#2708](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2708))
- `opentelemetry-instrumentation-pyramid` Record exceptions raised when serving a request
([#2622](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2622))
- `opentelemetry-sdk-extension-aws` Add AwsXrayLambdaPropagator
([#2573](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2573))
- `opentelemetry-instrumentation-confluent-kafka` Add support for version 2.4.0 of confluent_kafka
([#2616](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2616))
- `opentelemetry-instrumentation-asyncpg` Add instrumentation to cursor based queries
([#2501](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2501))
- `opentelemetry-instrumentation-confluent-kafka` Add support for produce purge
([#2638](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2638))
- `opentelemetry-instrumentation-asgi` Implement new semantic convention opt-in with stable http semantic conventions
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
- `opentelemetry-instrumentation-fastapi` Implement new semantic convention opt-in with stable http semantic conventions
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
- `opentelemetry-instrumentation-httpx` Implement new semantic convention opt-in migration with stable http semantic conventions
([#2631](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2631))
- `opentelemetry-instrumentation-system-metrics` Permit to use psutil 6.0+.
([#2630](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2630))
- `opentelemetry-instrumentation-system-metrics` Add support for capture open file descriptors
([#2652](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2652))
- `opentelemetry-instrumentation-httpx` Add support for instrument client with proxy
([#2664](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2664))
- `opentelemetry-instrumentation-aiohttp-client` Implement new semantic convention opt-in migration
([#2673](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2673))
- `opentelemetry-instrumentation-django` Add `http.target` to Django duration metric attributes
([#2624](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2624))
- `opentelemetry-instrumentation-urllib3` Implement new semantic convention opt-in migration
([#2715](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2715))
- `opentelemetry-instrumentation-django` Implement new semantic convention opt-in with stable http semantic conventions
([#2714](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2714))
- `opentelemetry-instrumentation-urllib` Implement new semantic convention opt-in migration
([#2736](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2736))
### Breaking changes
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-fastapi`, `opentelemetry-instrumentation-starlette` Use `tracer` and `meter` of originating components instead of one from `asgi` middleware
([#2580](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2580))
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `asgi` middleware
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `fastapi` middleware
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
- `opentelemetry-instrumentation-urllib3` Populate `{method}` as `HTTP` on `_OTHER` methods for span name
([#2715](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2715))
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `fastapi` instrumentation
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `django` middleware
([#2714](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2714))
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `urllib` instrumentation
([#2736](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2736))
- `opentelemetry-instrumentation-httpx`, `opentelemetry-instrumentation-aiohttp-client`,
`opentelemetry-instrumentation-requests` Populate `{method}` as `HTTP` on `_OTHER` methods
([#2726](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2726))
- `opentelemetry-instrumentation-fastapi` Add dependency support for fastapi-slim
([#2702](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2702))
- `opentelemetry-instrumentation-urllib3` improve request_hook, replacing `headers` and `body` parameters with a single `request_info: RequestInfo` parameter that now contains the `method` and `url` ([#2711](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2711))
### Fixed
- Handle `redis.exceptions.WatchError` as a non-error event in redis instrumentation
([#2668](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2668))
- `opentelemetry-instrumentation-httpx` Ensure httpx.get or httpx.request like methods are instrumented
([#2538](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2538))
- Add Python 3.12 support
([#2572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2572))
- `opentelemetry-instrumentation-aiohttp-server`, `opentelemetry-instrumentation-httpx` Ensure consistently use of suppress_instrumentation utils
([#2590](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2590))
- Reference symbols from generated semantic conventions
([#2611](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2611))
- `opentelemetry-instrumentation-psycopg` Bugfix: Handle empty statement.
([#2644](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2644))
- `opentelemetry-instrumentation-confluent-kafka` Confluent Kafka: Ensure consume span is ended when consumer is closed
([#2640](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2640))
- `opentelemetry-instrumentation-asgi` Fix generation of `http.target` and `http.url` attributes for ASGI apps
using sub apps
([#2477](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2477))
- `opentelemetry-instrumentation-aws-lambda` Bugfix: AWS Lambda event source key incorrect for SNS in instrumentation library.
([#2612](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2612))
- `opentelemetry-instrumentation-asyncio` instrumented `asyncio.wait_for` properly raises `asyncio.TimeoutError` as expected
([#2637](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2637))
- `opentelemetry-instrumentation-django` Handle exceptions from request/response hooks
([#2153](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2153))
- `opentelemetry-instrumentation-asgi` Removed `NET_HOST_NAME` AND `NET_HOST_PORT` from active requests count attribute
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
- `opentelemetry-instrumentation-asgi` Bugfix: Middleware did not set status code attribute on duration metrics for non-recording spans.
([#2627](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2627))
- `opentelemetry-instrumentation-mysql` Add support for `mysql-connector-python` v9
([#2751](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2751))
## Version 1.25.0/0.46b0 (2024-05-31)
### Breaking changes
- Add return statement to Confluent kafka Producer poll() and flush() calls when instrumented by ConfluentKafkaInstrumentor().instrument_producer() ([#2527](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2527))
- Rename `type` attribute to `asgi.event.type` in `opentelemetry-instrumentation-asgi`
([#2300](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2300))
- Rename AwsLambdaInstrumentor span attributes `faas.id` to `cloud.resource_id`, `faas.execution` to `faas.invocation_id`
([#2372](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2372))
- Drop support for instrumenting elasticsearch client < 6
([#2422](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2422))
- `opentelemetry-instrumentation-wsgi` Add `http.method` to `span.name`
([#2425](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2425))
- `opentelemetry-instrumentation-flask` Add `http.method` to `span.name`
([#2454](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2454))
- Record repeated HTTP headers in lists, rather than a comma separate strings for ASGI based web frameworks
([#2361](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2361))
- ASGI, FastAPI, Starlette: provide both send and receive hooks with `scope` and `message` for internal spans
- ([#2546](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2546))
### Added
- `opentelemetry-sdk-extension-aws` Register AWS resource detectors under the
`opentelemetry_resource_detector` entry point
([#2382](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2382))
- `opentelemetry-instrumentation-wsgi` Implement new semantic convention opt-in with stable http semantic conventions
([#2425](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2425))
- `opentelemetry-instrumentation-flask` Implement new semantic convention opt-in with stable http semantic conventions
([#2454](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2454))
- `opentelemetry-instrumentation-threading` Initial release for threading
([#2253](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2253))
- `opentelemetry-instrumentation-pika` Instrumentation for `channel.consume()` (supported
only for global, non channel specific instrumentation)
([#2397](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2397))
- `opentelemetry-processor-baggage` Initial release
([#2436](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2436))
- `opentelemetry-processor-baggage` Add baggage key predicate
([#2535](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2535))
### Fixed
- `opentelemetry-instrumentation-dbapi` Fix compatibility with Psycopg3 to extract libpq build version
([#2500](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2500))
- `opentelemetry-instrumentation-grpc` AioClientInterceptor should propagate with a Metadata object
([#2363](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2363))
- `opentelemetry-instrumentation-boto3sqs` Instrument Session and resource
([#2161](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2161))
- `opentelemetry-instrumentation-aws-lambda` Fix exception handling for events with requestContext
([#2418](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2418))
- Use sqlalchemy version in sqlalchemy commenter instead of opentelemetry library version
([#2404](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2404))
- `opentelemetry-instrumentation-asyncio` Check for cancelledException in the future
([#2461](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2461))
- Remove SDK dependency from opentelemetry-instrumentation-grpc
([#2474](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2474))
- `opentelemetry-instrumentation-elasticsearch` Improved support for version 8
([#2420](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2420))
- `opentelemetry-instrumentation-elasticsearch` Disabling instrumentation with native OTel support enabled
([#2524](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2524))
- `opentelemetry-instrumentation-asyncio` Check for **name** attribute in the coroutine
([#2521](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2521))
- `opentelemetry-instrumentation-requests` Fix wrong time unit for duration histogram
([#2553](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2553))
- `opentelemetry-util-http` Preserve brackets around literal IPv6 hosts ([#2552](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2552))
- `opentelemetry-util-redis` Fix net peer attribute for unix socket connection ([#2493](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2493))
## Version 1.24.0/0.45b0 (2024-03-28)
### Added
- `opentelemetry-instrumentation-psycopg` Async Instrumentation for psycopg 3.x
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))
### Fixed
- `opentelemetry-instrumentation-celery` Allow Celery instrumentation to be installed multiple times
([#2342](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2342))
- Align gRPC span status codes to OTEL specification
@ -28,29 +590,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- AwsLambdaInstrumentor sets `cloud.account.id` span attribute
([#2367](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2367))
### Added
- `opentelemetry-instrumentation-fastapi` Add support for configuring header extraction via runtime constructor parameters
([#2241](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2241))
## Version 1.23.0/0.44b0 (2024-02-23)
- Drop uspport for 3.7
- Drop support for 3.7
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151))
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))
- `opentelemetry-instrumentation-asyncpg` Allow AsyncPGInstrumentor to be instantiated multiple times
([#1791](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1791))
([#1791](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1791))
- `opentelemetry-instrumentation-confluent-kafka` Add support for higher versions until 2.3.0 of confluent_kafka
([#2132](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2132))
- `opentelemetry-resource-detector-azure` Changed timeout to 4 seconds due to [timeout bug](https://github.com/open-telemetry/opentelemetry-python/issues/3644)
([#2136](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2136))
- `opentelemetry-resource-detector-azure` Suppress instrumentation for `urllib` call
([#2178](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2178))
- AwsLambdaInstrumentor handles and re-raises function exception ([#2245](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2245))
- AwsLambdaInstrumentor handles and re-raises function exception
([#2245](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2245))
### Added
- `opentelemetry-instrumentation-psycopg` Initial release for psycopg 3.x
- `opentelemetry-instrumentation-asgi` Add support for configuring ASGI middleware header extraction via runtime constructor parameters
([#2026](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2026))
## Version 1.22.0/0.43b0 (2023-12-14)
### Added
- `opentelemetry-instrumentation-asyncio` Add support for asyncio
([#1919](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1943))
- `opentelemetry-instrumentation` Added Otel semantic convention opt-in mechanism
@ -72,7 +643,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1959](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1959))
- `opentelemetry-resource-detector-azure` Added dependency for Cloud Resource ID attribute
([#2072](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2072))
## Version 1.21.0/0.42b0 (2023-11-01)
### Added
@ -85,8 +656,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1948](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1948))
- Added schema_url (`"https://opentelemetry.io/schemas/1.11.0"`) to all metrics and traces
([#1977](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1977))
- Add support for configuring ASGI middleware header extraction via runtime constructor parameters
([#2026](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2026))
### Fixed
@ -117,6 +686,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#152](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2013))
## Version 1.19.0/0.40b0 (2023-07-13)
- `opentelemetry-instrumentation-asgi` Add `http.server.request.size` metric
([#1867](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1867))
@ -161,8 +731,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1879](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1879))
- Add optional distro and configurator selection for auto-instrumentation
([#1823](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1823))
- `opentelemetry-instrumentation-django` - Add option to add Opentelemetry middleware at specific position in middleware chain
([#2912]https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2912)
### Added
- `opentelemetry-instrumentation-kafka-python` Add instrumentation to `consume` method
([#1786](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1786))
@ -213,6 +786,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1692](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1692))
### Changed
- Update HTTP server/client instrumentation span names to comply with spec
([#1759](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1759))
@ -250,7 +824,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support `aio_pika` 9.x (([#1670](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1670])
- `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. ([#1572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572))
- `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. ([#1572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572))
- `opentelemetry-instrumentation-elasticsearch` Add optional db.statement query sanitization.
([#1598](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1598))
- `opentelemetry-instrumentation-celery` Record exceptions as events on the span.
@ -274,7 +848,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1575](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1575))
- Fix SQLAlchemy uninstrumentation
([#1581](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1581))
- `opentelemetry-instrumentation-grpc` Fix code()/details() of _OpentelemetryServicerContext.
- `opentelemetry-instrumentation-grpc` Fix code()/details() of \_OpentelemetryServicerContext.
([#1578](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1578))
- Fix aiopg instrumentation to work with aiopg < 2.0.0
([#1473](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1473))
@ -326,7 +900,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1430](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1430))
- `opentelemetry-instrumentation-aiohttp-client` Allow overriding of status in response hook.
([#1394](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1394))
- `opentelemetry-instrumentation-pymysql` Fix dbapi connection instrument wrapper has no _sock member.
- `opentelemetry-instrumentation-pymysql` Fix dbapi connection instrument wrapper has no \_sock member.
([#1424](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1424))
- `opentelemetry-instrumentation-dbapi` Fix the check for the connection already being instrumented in instrument_connection().
([#1424](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1424))
@ -411,7 +985,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add metric instrumentation in starlette
([#1327](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1327))
### Fixed
- `opentelemetry-instrumentation-kafka-python`: wait for metadata
@ -424,7 +997,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1208](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1208))
- `opentelemetry-instrumentation-aiohttp-client` Fix producing additional spans with each newly created ClientSession
- ([#1246](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1246))
- Add _is_opentelemetry_instrumented check in _InstrumentedFastAPI class
- Add \_is_opentelemetry_instrumented check in \_InstrumentedFastAPI class
([#1313](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1313))
- Fix uninstrumentation of existing app instances in FastAPI
([#1258](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1258))
@ -443,6 +1016,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1203](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1203))
### Added
- `opentelemetry-instrumentation-redis` add support to instrument RedisCluster clients
([#1177](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1177))
- `opentelemetry-instrumentation-sqlalchemy` Added span for the connection phase ([#1133](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1133))
@ -455,11 +1029,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.12.0rc2-0.32b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2-0.32b0) - 2022-07-01
- Pyramid: Only categorize 500s server exceptions as errors
([#1037](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1037))
### Fixed
- Fix bug in system metrics by checking their configuration
([#1129](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1129))
- Adding escape call to fix [auto-instrumentation not producing spans on Windows](https://github.com/open-telemetry/opentelemetry-python/issues/2703).
@ -472,8 +1046,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- fixed typo in `system.network.io` metric configuration
([#1135](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1135))
### Added
- `opentelemetry-instrumentation-aiohttp-client` Add support for optional custom trace_configs argument.
([1079](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1079))
- `opentelemetry-instrumentation-sqlalchemy` add support to instrument multiple engines
@ -497,10 +1071,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Integrated sqlcommenter plugin into opentelemetry-instrumentation-django
([#896](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/896))
## Version 1.12.0rc1/0.31b0 (2022-05-17)
### Fixed
- `opentelemetry-instrumentation-aiohttp-client` make span attributes available to sampler
([#1072](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1072))
- `opentelemetry-instrumentation-aws-lambda` Fixed an issue - in some rare cases (API GW proxy integration test)
@ -513,6 +1087,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-sdk-extension-aws` change timeout for AWS EC2 and EKS metadata requests from 1000 seconds and 2000 seconds to 1 second
### Added
- `opentelemetry-instrument` and `opentelemetry-bootstrap` now include a `--version` flag
([#1065](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1065))
- `opentelemetry-instrumentation-redis` now instruments asynchronous Redis clients, if the installed redis-py includes async support (>=4.2.0).
@ -520,22 +1095,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-boto3sqs` added AWS's SQS instrumentation.
([#1081](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1081))
## Version 1.11.1/0.30b1 (2022-04-21)
### Added
- `opentelemetry-instrumentation-starlette` Capture custom request/response headers in span attributes
([#1046](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1046))
### Fixed
- Prune autoinstrumentation sitecustomize module directory from PYTHONPATH immediately
([#1066](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1066))
## Version 1.11.0/0.30b0 (2022-04-18)
### Fixed
- `opentelemetry-instrumentation-pyramid` Fixed which package is the correct caller in _traced_init.
- `opentelemetry-instrumentation-pyramid` Fixed which package is the correct caller in \_traced_init.
([#830](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/830))
- `opentelemetry-instrumentation-tornado` Fix Tornado errors mapping to 500
([#1048](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1048))
@ -569,7 +1145,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-pyramid` Pyramid: Capture custom request/response headers in span attributes
([#1022](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1022))
## Version 1.10.0/0.29b0 (2022-03-10)
- `opentelemetry-instrumentation-wsgi` Capture custom request/response headers in span attributes
@ -583,7 +1158,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-aws-lambda` `SpanKind.SERVER` by default, add more cases for `SpanKind.CONSUMER` services. ([#926](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/926))
- `opentelemetry-instrumentation-sqlalchemy` added experimental sql commenter capability
([#924](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/924))
([#924](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/924))
- `opentelemetry-contrib-instrumentations` added new meta-package that installs all contrib instrumentations.
([#681](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/681))
- `opentelemetry-instrumentation-dbapi` add experimental sql commenter capability
@ -622,12 +1197,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Version 1.9.0/0.28b0 (2022-01-26)
### Added
- `opentelemetry-instrumentation-pyramid` Pyramid: Conditionally create SERVER spans
([#869](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/869))
- `opentelemetry-instrumentation-grpc` added `trailing_metadata` to _OpenTelemetryServicerContext.
- `opentelemetry-instrumentation-grpc` added `trailing_metadata` to \_OpenTelemetryServicerContext.
([#871](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/871))
- `opentelemetry-instrumentation-asgi` now returns a `traceresponse` response header.
([#817](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/817))
@ -661,12 +1235,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-aiohttp-client` aiohttp: Remove `span_name` from docs
([#857](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/857))
## Version 1.8.0/0.27b0 (2021-12-17)
### Added
- `opentelemetry-instrumentation-aws-lambda` Adds support for configurable flush timeout via `OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT` property. ([#825](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/825))
- `opentelemetry-instrumentation-aws-lambda` Adds support for configurable flush timeout via `OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT` property. ([#825](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/825))
- `opentelemetry-instrumentation-pika` Adds support for versions between `0.12.0` to `1.0.0`. ([#837](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/837))
### Fixed
@ -736,13 +1309,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#755](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/755))
### Added
- `opentelemetry-instrumentation-pika` Add `publish_hook` and `consume_hook` callbacks passed as arguments to the instrument method
([#763](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/763))
## Version 1.6.1/0.25b1 (2021-10-18)
### Changed
- `opentelemetry-util-http` no longer contains an instrumentation entrypoint and will not be loaded
automatically by the auto instrumentor.
([#745](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/745))
@ -756,7 +1330,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#760](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/760))
## Version 1.6.0/0.25b0 (2021-10-13)
### Added
- `opentelemetry-sdk-extension-aws` Release AWS Python SDK Extension as 1.0.0
([#667](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/667))
- `opentelemetry-instrumentation-urllib3`, `opentelemetry-instrumentation-requests`
@ -783,6 +1359,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#391](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/391))
### Changed
- `opentelemetry-instrumentation-flask` Fix `RuntimeError: Working outside of request context`
([#734](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/734))
- `opentelemetry-propagators-aws-xray` Rename `AwsXRayFormat` to `AwsXRayPropagator`
@ -813,6 +1390,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Version 1.5.0/0.24b0 (2021-08-26)
### Added
- `opentelemetry-sdk-extension-aws` Add AWS resource detectors to extension package
([#586](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/586))
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-aiohttp-client`, `openetelemetry-instrumentation-fastapi`,
@ -831,10 +1409,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Version 1.4.0/0.23b0 (2021-07-21)
### Removed
- Move `opentelemetry-instrumentation` to the core repo.
([#595](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/595))
### Changed
- `opentelemetry-instrumentation-falcon` added support for Falcon 3.
([#607](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/607))
- `opentelemetry-instrumentation-tornado` properly instrument work done in tornado on_finish method.
@ -882,12 +1462,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#568](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/568))
### Added
- `opentelemetry-instrumentation-httpx` Add `httpx` instrumentation
([#461](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/461))
## Version 1.3.0/0.22b0 (2021-06-01)
### Changed
- `opentelemetry-bootstrap` not longer forcibly removes and re-installs libraries and their instrumentations.
This means running bootstrap will not auto-upgrade existing dependencies and as a result not cause dependency
conflicts.
@ -904,6 +1486,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#488](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/488))
### Added
- `opentelemetry-instrumentation-botocore` now supports
context propagation for lambda invoke via Payload embedded headers.
([#458](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/458))
@ -913,6 +1496,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Version 1.2.0/0.21b0 (2021-05-11)
### Changed
- Instrumentation packages don't specify the libraries they instrument as dependencies
anymore. Instead, they verify the correct version of libraries are installed at runtime.
([#475](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/475))
@ -1464,6 +2048,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-ext-http-requests` Updates for core library changes
- `Added support for PyPy3` Initial release
## [#1033](https://github.com/open-telemetryopentelemetry-python-contrib/issues/1033)
## Version 0.1a0 (2019-09-30)
@ -1478,7 +2063,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))
- `opentelemetry-instrumentation-asyncpg` Allow AsyncPGInstrumentor to be instantiated multiple times
([#1791](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1791))
([#1791](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1791))
- `opentelemetry-instrumentation-confluent-kafka` Add support for higher versions until 2.3.0 of confluent_kafka
([#2132](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2132))
- `opentelemetry-resource-detector-azure` Changed timeout to 4 seconds due to [timeout bug](https://github.com/open-telemetry/opentelemetry-python/issues/3644)
@ -1486,4 +2071,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-resource-detector-azure` Suppress instrumentation for `urllib` call
([#2178](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2178))
- AwsLambdaInstrumentor handles and re-raises function exception ([#2245](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2245))

View File

@ -13,24 +13,37 @@ on how to become a [**Member**](https://github.com/open-telemetry/community/blob
[**Approver**](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
and [**Maintainer**](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).
Before you can contribute, you will need to sign the [Contributor License Agreement](https://docs.linuxfoundation.org/lfx/easycla/contributors).
Please also read the [OpenTelemetry Contributor Guide](https://github.com/open-telemetry/community/blob/main/guides/contributor/README.md).
## Index
* [Find a Buddy and get Started Quickly](#find-a-buddy-and-get-started-quickly)
* [Development](#development)
* [Troubleshooting](#troubleshooting)
* [Benchmarks](#benchmarks)
* [Pull requests](#pull-requests)
* [How to Send Pull Requests](#how-to-send-pull-requests)
* [How to Receive Comments](#how-to-receive-comments)
* [How to Get PRs Reviewed](#how-to-get-prs-reviewed)
* [How to Get PRs Merged](#how-to-get-prs-merged)
* [Design Choices](#design-choices)
* [Focus on Capabilities, Not Structure Compliance](#focus-on-capabilities-not-structure-compliance)
* [Running Tests Locally](#running-tests-locally)
* [Testing against a different Core repo branch/commit](#testing-against-a-different-core-repo-branchcommit)
* [Style Guide](#style-guide)
* [Guideline for instrumentations](#guideline-for-instrumentations)
* [Expectations from contributors](#expectations-from-contributors)
- [Contributing to opentelemetry-python-contrib](#contributing-to-opentelemetry-python-contrib)
- [Index](#index)
- [Find a Buddy and get Started Quickly](#find-a-buddy-and-get-started-quickly)
- [Development](#development)
- [Virtual Environment](#virtual-environment)
- [Troubleshooting](#troubleshooting)
- [Benchmarks](#benchmarks)
- [Pull Requests](#pull-requests)
- [How to Send Pull Requests](#how-to-send-pull-requests)
- [How to Receive Comments](#how-to-receive-comments)
- [How to Get PRs Reviewed](#how-to-get-prs-reviewed)
- [How to Get PRs Merged](#how-to-get-prs-merged)
- [Design Choices](#design-choices)
- [Focus on Capabilities, Not Structure Compliance](#focus-on-capabilities-not-structure-compliance)
- [Running Tests Locally](#running-tests-locally)
- [Testing against a different Core repo branch/commit](#testing-against-a-different-core-repo-branchcommit)
- [Style Guide](#style-guide)
- [Guideline for instrumentations](#guideline-for-instrumentations)
- [Update supported instrumentation package versions](#update-supported-instrumentation-package-versions)
- [Guideline for GenAI instrumentations](#guideline-for-genai-instrumentations)
- [Get Involved](#get-involved)
- [Expectations from contributors](#expectations-from-contributors)
- [Updating supported Python versions](#updating-supported-python-versions)
- [Bumping the Python baseline](#bumping-the-python-baseline)
- [Adding support for a new Python release](#adding-support-for-a-new-python-release)
## Find a Buddy and get Started Quickly
@ -54,35 +67,63 @@ To install `tox`, run:
pip install tox
```
You can also run tox with `uv` support. By default [tox.ini](./tox.ini) will automatically create a provisioned tox environment with `tox-uv`, but you can install it at host level:
```sh
pip install tox-uv
```
You can run `tox` with the following arguments:
- `tox` to run all existing tox commands, including unit tests for all packages
* `tox` to run all existing tox commands, including unit tests for all packages
under multiple Python versions
- `tox -e docs` to regenerate the API docs
- `tox -e py311-test-instrumentation-aiopg` to e.g. run the aiopg instrumentation unit tests under a specific
* `tox -e docs` to regenerate all docs
* `tox -e py312-test-instrumentation-aiopg` to e.g. run the aiopg instrumentation unit tests under a specific
Python version
- `tox -e spellcheck` to run a spellcheck on all the code
- `tox -e lint` to run lint checks on all code
* `tox -e spellcheck` to run a spellcheck on all the code
* `tox -e lint-some-package` to run lint checks on `some-package`
* `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated
* `tox -e ruff` to run ruff linter and formatter checks against the entire codebase
`black` and `isort` are executed when `tox -e lint` is run. The reported errors can be tedious to fix manually.
An easier way to do so is:
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
1. Run `.tox/lint/bin/black .`
2. Run `.tox/lint/bin/isort .`
```console
pip install pre-commit -c dev-requirements.txt
```
and run this command inside the git repository:
```console
pre-commit install
```
See
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
for more detail on available tox commands.
### Virtual Environment
You can also create a single virtual environment to make it easier to run local tests.
For that, you'll need to install [`uv`](https://docs.astral.sh/uv/getting-started/installation/).
After installing `uv`, you can run the following command:
```sh
uv sync
```
This will create a virtual environment in the `.venv` directory and install all the necessary dependencies.
### Troubleshooting
> Some packages may require additional system wide dependencies to be installed. For example, you may need to install `libpq-dev` to run the postgresql client libraries instrumentation tests. or `libsnappy-dev` to run the prometheus exporter tests. If you encounter a build error, please check the installation instructions for the package you are trying to run tests for.
Some packages may require additional system-wide dependencies to be installed. For example, you may need to install `libpq-dev` to run the postgresql client libraries instrumentation tests or `libsnappy-dev` to run the prometheus exporter tests. If you encounter a build error, please check the installation instructions for the package you are trying to run tests for.
For `docs` building, you may need to install `mysql-client` and other required dependencies as necessary. Ensure the Python version used in your local setup matches the version used in the [CI](./.github/workflows/) to maintain compatibility when building the documentation.
### Benchmarks
Performance progression of benchmarks for packages distributed by OpenTelemetry Python can be viewed as a [graph of throughput vs commit history](https://opentelemetry-python-contrib.readthedocs.io/en/latest/performance/benchmarks.html). From the linked page, you can download a JSON file with the performance results.
Running the `tox` tests also runs the performance tests if any are available. Benchmarking tests are done with `pytest-benchmark` and they output a table with results to the console.
Some packages have benchmark tests. To run them, run `tox -f benchmark`. Benchmark tests use `pytest-benchmark` and they output a table with results to the console.
To write benchmarks, simply use the [pytest benchmark fixture](https://pytest-benchmark.readthedocs.io/en/latest/usage.html#usage) like the following:
@ -98,10 +139,10 @@ def test_simple_start_span(benchmark):
benchmark(benchmark_start_as_current_span, "benchmarkedSpan", 42)
```
Make sure the test file is under the `tests/performance/benchmarks/` folder of
Make sure the test file is under the `benchmarks/` folder of
the package it is benchmarking and further has a path that corresponds to the
file in the package it is testing. Make sure that the file name begins with
`test_benchmark_`. (e.g. `propagator/opentelemetry-propagator-aws-xray/tests/performance/benchmarks/trace/propagation/test_benchmark_aws_xray_propagator.py`)
`test_benchmark_`. (e.g. `propagator/opentelemetry-propagator-aws-xray/benchmarks/trace/propagation/test_benchmark_aws_xray_propagator.py`)
## Pull Requests
@ -114,6 +155,7 @@ To create a new PR, fork the project in GitHub and clone the upstream repo:
```sh
git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git
cd opentelemetry-python-contrib
```
Add your fork as an origin:
@ -122,19 +164,33 @@ Add your fork as an origin:
git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git
```
Run tests:
make sure you have all supported versions of Python installed, install `tox` only for the first time:
```sh
# make sure you have all supported versions of Python installed
$ pip install tox # only first time.
$ tox # execute in the root of the repository
pip install tox tox-uv
```
Run tests in the root of the repository (this will run all tox environments and may take some time):
```sh
tox
```
Check out a new branch, make modifications and push the branch to your fork:
```sh
git checkout -b feature
# edit files
```
After you edit the files, stage changes in the current directory:
```sh
git add .
```
Then run the following to commit the changes:
```sh
git commit
git push fork feature
```
@ -145,6 +201,7 @@ Open a pull request against the main `opentelemetry-python-contrib` repo.
* If the PR is not ready for review, please put `[WIP]` in the title, tag it
as `work-in-progress`, or mark it as [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/).
* Make sure tests and lint are passing locally before requesting a review.
* Make sure CLA is signed and CI is clear.
### How to Get PRs Reviewed
@ -200,13 +257,26 @@ For a deeper discussion, see: https://github.com/open-telemetry/opentelemetry-sp
2. Make sure you have `tox` installed. `pip install tox`.
3. Run `tox` without any arguments to run tests for all the packages. Read more about [tox](https://tox.readthedocs.io/en/latest/).
Some tests can be slow due to pre-steps that do dependencies installs. To help with that, you can run tox a first time, and after that run the tests using previous installed dependencies in toxdir as following:
1. First time run (e.g., opentelemetry-instrumentation-aiopg)
```console
tox -e py312-test-instrumentation-aiopg
```
2. Run tests again without pre-steps:
```console
.tox/py312-test-instrumentation-aiopg/bin/pytest instrumentation/opentelemetry-instrumentation-aiopg
```
### Testing against a different Core repo branch/commit
Some of the tox targets install packages from the [OpenTelemetry Python Core Repository](https://github.com/open-telemetry/opentelemetry-python) via pip. The version of the packages installed defaults to the main branch in that repository when tox is run locally. It is possible to install packages tagged with a specific git commit hash by setting an environment variable before running tox as per the following example:
```sh
CORE_REPO_SHA=c49ad57bfe35cfc69bfa863d74058ca9bec55fc3 tox
```
The continuation integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/.github/workflows/test.yml#L9).
The continuous integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/test_0.yml#L14).
## Style Guide
@ -221,7 +291,10 @@ The continuation integration overrides that environment variable with as per the
Below is a checklist of things to be mindful of when implementing a new instrumentation or working on a specific instrumentation. It is one of our goals as a community to keep the implementation specific details of instrumentations as similar across the board as possible for ease of testing and feature parity. It is also good to abstract as much common functionality as possible.
- Follow semantic conventions
- The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/semantic-conventions.md)
- The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/semantic-conventions/tree/main/docs).
- To ensure consistency, we encourage contributions that align with [STABLE](https://opentelemetry.io/docs/specs/otel/document-status/#lifecycle-status) semantic conventions if available. This approach helps us avoid potential confusion and reduces the need to support multiple outdated versions of semantic conventions. However, we are still open to considering exceptional cases where changes are well justified.
- Contributions related to outdated HTTP semantic conventions (conventions prior to becoming [stable](https://github.com/open-telemetry/semantic-conventions/tree/v1.23.0)) will likely be discouraged, as they increase complexity and the potential for misconceptions.
- Contains a name that is not already claimed in [Pypi](https://pypi.org/). Contact a maintainer, bring the issue up in the weekly Python SIG or create a ticket in Pypi if a desired name has already been taken.
- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L35)
- Supports auto-instrumentation
- Add an entry point (ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44>)
@ -240,7 +313,63 @@ Below is a checklist of things to be mindful of when implementing a new instrume
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L234>
- Appropriate error handling
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L220>
- Isolate sync and async test
- For synchronous tests, the typical test case class is inherited from `opentelemetry.test.test_base.TestBase`. However, if you want to write asynchronous tests, the test case class should inherit also from `IsolatedAsyncioTestCase`. Adding asynchronous tests to a common test class can lead to tests passing without actually running, which can be misleading.
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/60fb936b7e5371b3e5587074906c49fb873cbd76/instrumentation/opentelemetry-instrumentation-grpc/tests/test_aio_server_interceptor.py#L84>
- Most of the instrumentations have the same version. If you are going to develop a new instrumentation it would probably have `X.Y.dev` version and depends on `opentelemetry-instrumentation` and `opentelemetry-semantic-conventions` for a [compatible version](https://peps.python.org/pep-0440/#compatible-release). That means that you may need to install the instrumentation dependencies from this repo and the core repo from git.
- Documentation
- When adding a new instrumentation remember to add an entry in `docs/instrumentation/` named `<instrumentation>/<instrumentation>.rst` to have the instrumentation documentation referenced from the index. You can use the entry template available [here](./_template/autodoc_entry.rst)
- Testing
- When adding a new instrumentation remember to update `tox.ini` adding appropriate rules in `envlist`, `command_pre` and `commands` sections
### Update supported instrumentation package versions
- Navigate to the **instrumentation package directory:**
- Update **`pyproject.toml`** file by modifying _instruments_ entry in the `[project.optional-dependencies]` section with the new version constraint
- Update `_instruments` variable in instrumentation **`package.py`** file with the new version constraint
- At the **root of the project directory**, run `tox -e generate` to regenerate necessary files
If you're adding support for a new version of the instrumentation package, follow these additional steps:
- At the **instrumentation package directory:** Add new test-requirements.txt file with the respective package version required for testing
- At the **root of the project directory**: Add a new test environment entry for the package version in [tox.ini](./tox.ini) and run `tox -e generate-workflows` to regenerate new workflows accordingly. In the same [tox.ini](./tox.ini) file, search for `opentelemetry-instrumentation-{package}/test-requirements` and add a new line to point to the new test-requirements.txt you created in the previous step so tox can install the correct requirements.
Example PRs: [#2976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2976), [#2845](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2845)
## Guideline for GenAI instrumentations
Instrumentations that relate to [Generative AI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) systems will be placed in the [instrumentation-genai](./instrumentation-genai) folder. This section covers contributions related to those instrumentations. Please note that the [guidelines for instrumentations](#guideline-for-instrumentations) and [expectations from contributors](#expectations-from-contributors) still apply.
### Get Involved
* Reviewing PRs: If you would like to be tagged as reviewer in new PRs related to these instrumentations, please submit a PR to add your GitHub handle to [component_owners.yml](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/component_owners.yml) under the corresponding instrumentation folder(s).
* Approving PRs: If you would like to be able to approve PRs related to these instrumentations, you must join [opentelemetry-python-contrib-approvers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-approvers) team. Please ask one of the [Python contrib maintainers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-maintainers) to be accepted into the team.
* Tracking and Creating Issues: For tracking issues related to Generative AI, please filter or add the label [gen-ai](https://github.com/open-telemetry/opentelemetry-python-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Agen-ai) when creating or searching issues. If you do not see an issue related to an instrumentation you would like to contribute to, please create a new tracking issue so the community is aware of its progress.
## Expectations from contributors
OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.
## Updating supported Python versions
### Bumping the Python baseline
When updating the minimum supported Python version remember to:
- Remove the version in `pyproject.toml` trove classifiers
- Remove the version from `tox.ini`
- Update github workflows accordingly with `tox -e generate-workflows`
- Search for `sys.version_info` usage and remove code for unsupported versions
- Bump `py-version` in `.pylintrc` for Python version dependent checks
### Adding support for a new Python release
When adding support for a new Python release remember to:
- Add the version in `tox.ini`
- Add the version in `pyproject.toml` trove classifiers
- Update github workflows accordingly with `tox -e generate-workflows`; lint and benchmarks use the latest supported version
- Update `.pre-commit-config.yaml`
- Update tox examples in the documentation

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright The OpenTelemetry Authors
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@ -186,7 +186,8 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2016 Datadog, Inc.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -20,8 +20,11 @@
<img alt="license" src="https://img.shields.io/badge/license-Apache_2.0-green.svg?style=for-the-badge">
</a>
<br/>
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/actions?query=workflow%3ATest+branch%3Amaster">
<img alt="Build Status" src="https://github.com/open-telemetry/opentelemetry-python-contrib/workflows/Test/badge.svg">
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/test_0.yml">
<img alt="Build Status 0" src="https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/test_0.yml/badge.svg?branch=main">
</a>
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/test_1.yml">
<img alt="Build Status 1" src="https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/test_1.yml/badge.svg?branch=main">
</a>
<img alt="Beta" src="https://img.shields.io/badge/status-beta-informational?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAA8A2UOAAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABK5JREFUSA2dVm1sFEUYfmd2b/f2Pkqghn5eEQWKrRgjpkYgpoRCLC0oxV5apAiGUDEpJvwxEQ2raWPU+Kf8INU/RtEedwTCR9tYPloxGNJYTTQUwYqJ1aNpaLH3sXu3t7vjvFevpSqt7eSyM+/czvM8877PzB3APBoLgoDLsNePF56LBwqa07EKlDGg84CcWsI4CEbhNnDpAd951lXE2NkiNknCCTLv4HtzZuvPm1C/IKv4oDNXqNDHragety2XVzjECZsJARuBMyRzJrh1O0gQwLXuxofxsPSj4hG8fMLQo7bl9JJD8XZfC1E5yWFOMtd07dvX5kDwg6+2++Chq8txHGtfPoAp0gOFmhYoNFkHjn2TNUmrwRdna7W1QSkU8hvbGk4uThLrapaiLA2E6QY4u/lS9ItHfvJkxYsTMVtnAJLipYIWtVrcdX+8+b8IVnPl/R81prbuPZ1jpYw+0aEUGSkdFsgyBIaFTXCm6nyaxMtJ4n+TeDhJzGqZtQZcuYDgqDwDbqb0JF9oRpIG1Oea3bC1Y6N3x/WV8Zh83emhCs++hlaghDw+8w5UlYKq2lU7Pl8IkvS9KDqXmKmEwdMppVPKwGSEilmyAwJhRwWcq7wYC6z4wZ1rrEoMWxecdOjZWXeAQClBcYDN3NwVwD9pGwqUSyQgclcmxpNJqCuwLmDh3WtvPqXdlt+6Oz70HPGDNSNBee/EOen+rGbEFqDENBPDbtdCp0ukPANmzO0QQJYUpyS5IJJI3Hqt4maS+EB3199ozm8EDU/6fVNU2dQpdx3ZnKzeFXyaUTiasEV/gZMzJMjr3Z+WvAdQ+hs/zw9savimxUntDSaBdZ2f+Idbm1rlNY8esFffBit9HtK5/MejsrJVxikOXlb1Ukir2X+Rbdkd1KG2Ixfn2Ql4JRmELnYK9mEM8G36fAA3xEQ89fxXihC8q+sAKi9jhHxNqagY2hiaYgRCm0f0QP7H4Fp11LSXiuBY2aYFlh0DeDIVVFUJQn5rCnpiNI2gvLxHnASn9DIVHJJlm5rXvQAGEo4zvKq2w5G1NxENN7jrft1oxMdekETjxdH2Z3x+VTVYsPb+O0C/9/auN6v2hNZw5b2UOmSbG5/rkC3LBA+1PdxFxORjxpQ81GcxKc+ybVjEBvUJvaGJ7p7n5A5KSwe4AzkasA+crmzFtowoIVTiLjANm8GDsrWW35ScI3JY8Urv83tnkF8JR0yLvEt2hO/0qNyy3Jb3YKeHeHeLeOuVLRpNF+pkf85OW7/zJxWdXsbsKBUk2TC0BCPwMq5Q/CPvaJFkNS/1l1qUPe+uH3oD59erYGI/Y4sce6KaXYElAIOLt+0O3t2+/xJDF1XvOlWGC1W1B8VMszbGfOvT5qaRRAIFK3BCO164nZ0uYLH2YjNN8thXS2v2BK9gTfD7jHVxzHr4roOlEvYYz9QIz+Vl/sLDXInsctFsXjqIRnO2ZO387lxmIboLDZCJ59KLFliNIgh9ipt6tLg9SihpRPDO1ia5byw7de1aCQmF5geOQtK509rzfdwxaKOIq+73AvwCC5/5fcV4vo3+3LpMdtWHh0ywsJC/ZGoCb8/9D8F/ifgLLl8S8QWfU8cAAAAASUVORK5CYII=">
</p>
@ -30,7 +33,7 @@
<strong>
<a href="CONTRIBUTING.md">Contributing<a/>
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
<a href="https://opentelemetry-python-contrib.readthedocs.io/en/stable/#examples">Examples<a/>
<a href="https://opentelemetry-python-contrib.readthedocs.io/en/latest/#instrumentations">Instrumentations<a/>
</strong>
</p>
@ -45,8 +48,8 @@ The Python auto-instrumentation libraries for [OpenTelemetry](https://openteleme
* [Installation](#installation)
* [Releasing](#releasing)
* [Releasing a package as `1.0` stable](#releasing-a-package-as-10-stable)
* [Semantic Convention status of instrumentations](#semantic-convention-status-of-instrumentations)
* [Contributing](#contributing)
* [Running Tests Locally](#running-tests-locally)
* [Thanks to all the people who already contributed](#thanks-to-all-the-people-who-already-contributed)
## Installation
@ -71,7 +74,7 @@ pip install opentelemetry-instrumentation-{integration}
To install the development versions of these packages instead, clone or fork
this repo and do an [editable
install](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs):
install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
```sh
pip install -e ./instrumentation/opentelemetry-instrumentation-{integration}
@ -96,53 +99,60 @@ To release a package as `1.0` stable, the package:
- e.g. If an instrumentation package uses flags, a token as context, or parameters that are not typical of the `BaseInstrumentor` class, these are documented
- After the release of `1.0`, a CODEOWNER may no longer feel like they have the bandwidth to meet the responsibilities of maintaining the package. That's not a problem at all, life happens! However, if that is the case, we ask that the CODEOWNER please raise an issue indicating that they would like to be removed as a CODEOWNER so that they don't get pinged on future PRs. Ultimately, we hope to use that issue to find a new CODEOWNER.
## Semantic Convention status of instrumentations
In our efforts to maintain optimal user experience and prevent breaking changes for transitioning into stable semantic conventions, OpenTelemetry Python is adopting the semantic convention migration plan for several instrumentations. Currently this plan is only being adopted for [HTTP-related instrumentations](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/non-normative/http-migration.md), but will eventually cover all types. Please refer to the `semconv status` column of the [instrumentation README](instrumentation/README.md) of the current status of instrumentations' semantic conventions. The possible values are `development`, `stable` and `migration` referring to [status](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.31.0/specification/document-status.md#lifecycle-status) of that particular semantic convention. `Migration` refers to an instrumentation that currently supports the migration plan.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
We meet weekly on Thursday, and the time of the meeting alternates between 9AM PT and 4PM PT. The meeting is subject to change depending on contributors' availability. Check the [OpenTelemetry community calendar](https://calendar.google.com/calendar/embed?src=google.com_b79e3e90j7bbsa2n2p5an5lf60%40group.calendar.google.com) for specific dates and for the Zoom link.
We meet weekly on Thursday at 9AM PT. The meeting is subject to change depending on contributors' availability. Check the [OpenTelemetry community calendar](https://calendar.google.com/calendar/embed?src=c_2bf73e3b6b530da4babd444e72b76a6ad893a5c3f43cf40467abc7a9a897f977%40group.calendar.google.com) for specific dates and for the Zoom link.
Meeting notes are available as a public [Google doc](https://docs.google.com/document/d/1CIMGoIOZ-c3-igzbd6_Pnxx1SjAkjwqoYSUWxPY8XIs/edit). For edit access, get in touch on [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-python/discussions).
Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telemetry/teams/python-approvers)):
### Maintainers
- [Aaron Abbott](https://github.com/aabmass), Google
- [Jeremy Voss](https://github.com/jeremydvoss), Microsoft
- [Sanket Mehta](https://github.com/sanketmehta28), Cisco
Emeritus Approvers:
- [Héctor Hernández](https://github.com/hectorhdzg), Microsoft
- [Yusuke Tsutsumi](https://github.com/toumorokoshi), Google
- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS
- [Ashutosh Goel](https://github.com/ashu658), Cisco
*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).*
Maintainers ([@open-telemetry/python-maintainers](https://github.com/orgs/open-telemetry/teams/python-maintainers)):
- [Diego Hurtado](https://github.com/ocelotl), Lightstep
- [Leighton Chen](https://github.com/lzchen), Microsoft
- [Riccardo Magliocchetti](https://github.com/xrmx), Elastic
- [Shalev Roda](https://github.com/shalevr), Cisco
Emeritus Maintainers:
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
- [Alex Boten](https://github.com/codeboten), Lightstep
### Approvers
- [Emídio Neto](https://github.com/emdneto), PicPay
- [Jeremy Voss](https://github.com/jeremydvoss), Microsoft
- [Owais Lone](https://github.com/owais), Splunk
- [Pablo Collins](https://github.com/pmcollins), Splunk
- [Sanket Mehta](https://github.com/sanketmehta28), Cisco
- [Srikanth Chekuri](https://github.com/srikanthccv), signoz.io
- [Tammy Baylis](https://github.com/tammy-baylis-swi), SolarWinds
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).*
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
## Running Tests Locally
### Emeritus Maintainers
1. Go to your Contrib repo directory. `cd ~/git/opentelemetry-python-contrib`.
2. Create a virtual env in your Contrib repo directory. `python3 -m venv my_test_venv`.
3. Activate your virtual env. `source my_test_venv/bin/activate`.
4. Make sure you have `tox` installed. `pip install tox`.
5. Run tests for a package. (e.g. `tox -e test-instrumentation-flask`.)
- [Alex Boten](https://github.com/codeboten)
- [Diego Hurtado](https://github.com/ocelotl)
- [Owais Lone](https://github.com/owais)
- [Yusuke Tsutsumi](https://github.com/toumorokoshi)
### Thanks to all the people who already contributed
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
### Emeritus Approvers
- [Ashutosh Goel](https://github.com/ashu658)
- [Héctor Hernández](https://github.com/hectorhdzg)
- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN)
- [Nikolay Sokolik](https://github.com/nikosokolik)
- [Nikolay Sokolik](https://github.com/oxeye-nikolay)
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
### Thanks to all of our contributors!
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-python-contrib" />
<img alt="Repo contributors" src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-python-contrib" />
</a>

View File

@ -9,8 +9,30 @@
(otherwise the workflow will pick up the version from `main` and just remove the `.dev` suffix).
* Review the two pull requests that it creates.
(one is targeted to the release branch and one is targeted to `main`).
* Merge the one targeted towards the release branch.
* The builds will fail for the `main` pr because of validation rules. Follow the [release workflow](https://github.com/open-telemetry/opentelemetry-python/blob/main/RELEASING.md) for the core repo up until this same point. Change the SHAs of each PR to point at each other to get the `main` builds to pass.
* The builds will fail for the release PR because of validation rules. Follow the [release workflow](https://github.com/open-telemetry/opentelemetry-python/blob/main/RELEASING.md) for the core repo up until this same point.
* Close and reopen the PR so that the workflow will take into account the label automation we have in place
* Merge the release PR.
* Merge the PR to main (this can be done separately from [making the release](#making-the-release))
### Preparing a major or minor release for individual package
> [!NOTE]
> Per-package release is supported for the following packages only:
> - opentelemetry-propagator-aws-xray
> - opentelemetry-resource-detector-azure
> - opentelemetry-sdk-extension-aws
> - opentelemetry-instrumentation-openai-v2
> - opentelemetry-instrumentation-vertexai
> - opentelemetry-instrumentation-google-genai
>
> These libraries are also excluded from the general release.
Package release preparation is handled by the [`[Package] Prepare release`](./.github/workflows/package-prepare-release.yml) workflow that allows
to pick a specific package to release. It follows the same versioning strategy and process as the general release.
Long-term package release branch follows `package-release/{package-name}/v{major}.{minor}.x` (or `package-release/{package-name}/v{major}.{minor}bx`) naming pattern.
The workflow will create two pull requests, one against the `main` and one against the `package-release/` branch; both should be merged in order to proceed with the release.
## Preparing a new patch release
@ -19,6 +41,8 @@
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, then enter the pull request number that you want to backport,
then click the "Run workflow" button below that.
* Add the label `backport` to the generated pull request.
* In case label automation doesn't work, just close and reopen the PR so that the workflow will take into account the label automation we have in place.
* Review and merge the backport pull request that it generates.
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
* The heading for the unreleased entries should be `## Unreleased`.
@ -26,6 +50,20 @@
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
* Review and merge the pull request that it creates for updating the version.
* Note: If you are doing a patch release in `-contrib` repo, you should also do an equivalent patch release in `-core` repo (even if there's no fix to release), otherwise tests in CI will fail.
### Preparing a patch release for individual package
> [!NOTE]
> Per-package release is supported only for packages included in the corresponding workflow. Libraries that support per-package release are currently
> excluded from the general patch release.
Per-package patch release preparation is handled by the [`[Package] Prepare patch release`](./.github/workflows/package-prepare-patch-release.yml) workflow that allows
to pick a specific package to release.
The workflow can only be run against long-term release branch such as `package-release/{package-name}/v{major}.{minor}.x` or `package-release/{package-name}/v{major}.{minor}bx`.
The workflow will create a pull request that should be merged in order to proceed with the release.
## Making the release
@ -36,6 +74,33 @@
* Review and merge the pull request that it creates for updating the change log in main
(note that if this is not a patch release then the change log on main may already be up-to-date,
in which case no pull request will be created).
* Verify that a new [Github release](https://github.com/open-telemetry/opentelemetry-python-contrib/releases) has been created and that the CHANGELOGs look correct.
### Releasing individual package
> [!NOTE]
> Per-package patch release is supported for the following packages only:
> - opentelemetry-propagator-aws-xray
> - opentelemetry-resource-detector-azure
> - opentelemetry-sdk-extension-aws
> - opentelemetry-instrumentation-openai-v2
> - opentelemetry-instrumentation-vertexai
> - opentelemetry-instrumentation-google-genai
>
> These libraries are also excluded from the general patch release.
Per-package release is handled by the [`[Package] Release`](./.github/workflows/package-release.yml) workflow that allows
to pick a specific package to release.
The workflow can only be run against long-term release branch such as `package-release/{package-name}/v{major}.{minor}.x` or `package-release/{package-name}/v{major}.{minor}bx`.
## After the release
* Check PyPI
* This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/release.yml).
* Check the [action logs](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml) to make sure packages have been uploaded to PyPI
* Check the release history (e.g. https://pypi.org/project/opentelemetry-instrumentation/#history) on PyPI
* If for some reason the action failed, see [Publish failed](#publish-failed) below
## Notes about version numbering for stable components
@ -68,27 +133,9 @@
* The version number for unstable components in the `main` branch will be bumped to the next version,
e.g. `0.{Y+1}b0.dev`.
## After the release
## Releasing dev version of new packages to claim namespace
* Check PyPI
* This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/release.yml).
* Check the [action logs](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml) to make sure packages have been uploaded to PyPI
* Check the release history (e.g. https://pypi.org/project/opentelemetry-instrumentation/#history) on PyPI
* If for some reason the action failed, see [Publish failed](#publish-failed) below
* Move stable tag
* Run the following (TODO automate):
```bash
git tag -d stable
git tag stable
git push --delete origin tagname
git push origin stable
```
* This will ensure the docs are pointing at the stable release.
* To validate this worked, ensure the stable build has run successfully:
<https://readthedocs.org/projects/opentelemetry-python/builds/>.
If the build has not run automatically, it can be manually trigger via the readthedocs interface.
When a contribution introduces a new package, in order to mitigate name-squatting incidents, release the current development version of the new package under the `opentelemetry` user to simply claim the namespace. This should be done shortly after the PR that introduced this package has been merged into `main`.
## Troubleshooting

View File

@ -0,0 +1,7 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-<REPLACE ME>/README.rst
:end-before: References
.. automodule:: opentelemetry.instrumentation.<REPLACE ME>
:members:
:undoc-members:
:show-inheritance:

View File

@ -12,7 +12,7 @@ dynamic = ["version"]
description = "<REPLACE ME>"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
@ -22,10 +22,11 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"opentelemetry-api ~= 1.12",
@ -34,12 +35,13 @@ dependencies = [
[project.entry-points.opentelemetry_instrumentor]
# REPLACE ME: the entrypoint for the instrumentor e.g
# sqlalchemy = "opentelemetry.instrumentation.sqlalchemy:SQLAlchemyInstrumentor"
<REPLACE ME> = "opentelemetry.instrumentation.<REPLACE>"
REPLACE_ME = "opentelemetry.instrumentation.<REPLACE>"
[project.urls]
# url of the instrumentation e.g
# Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-sqlalchemy"
Homepage = "<REPLACE ME>"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
[tool.hatch.version]
# REPLACE ME: the path to the version file e.g

View File

@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.45b0.dev"
__version__ = "0.57b0.dev"

View File

@ -1,19 +1,18 @@
pylint==3.0.2
flake8==6.1.0
isort==5.12.0
black==22.3.0
httpretty==1.1.4
mypy==0.931
pyright==v1.1.396
sphinx==7.1.2
sphinx-rtd-theme==2.0.0rc4
sphinx-autodoc-typehints==1.25.2
pytest==7.1.3
pytest==7.4.4
pytest-cov==4.1.0
readme-renderer==42.0
bleach==4.1.0 # transient dependency for readme-renderer
protobuf~=3.13
markupsafe>=2.0.1
codespell==2.1.0
requests==2.31.0
requests==2.32.3
ruamel.yaml==0.17.21
flaky==3.7.0
pre-commit==3.7.0; python_version >= '3.9'
pre-commit==3.5.0; python_version < '3.9'
ruff==0.6.9

View File

@ -2,14 +2,6 @@ sphinx==7.1.2
sphinx-rtd-theme==2.0.0rc4
sphinx-autodoc-typehints==1.25.2
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
# doesn't work for pkg_resources.
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-api&subdirectory=opentelemetry-api"
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions"
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk"
-e "git+https://github.com/open-telemetry/opentelemetry-python-contrib.git#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http"
./opentelemetry-instrumentation
# Required by opentelemetry-instrumentation
fastapi>=0.65.2
pymemcache~=1.3
@ -20,33 +12,37 @@ django>=2.2
# Required by instrumentation and exporter packages
aio_pika~=7.2.0
aiohttp~=3.0
aiokafka~=0.11.0
aiopg>=0.13.0,<1.3.0
asyncpg>=0.12.0
asyncclick~=8.0
boto~=2.0
botocore~=1.0
boto3~=1.0
cassandra-driver~=3.25
celery>=4.0
confluent-kafka>= 1.8.2,<= 2.3.0
elasticsearch>=2.0,<9.0
confluent-kafka>= 1.8.2,<= 2.4.0
elasticsearch>=6.0,<9.0
flask~=2.0
falcon~=2.0
grpcio~=1.27
httpx>=0.18.0
kafka-python>=2.0,<3.0
mysql-connector-python~=8.0
mysqlclient~=2.1.1
openai >= 1.26.0
psutil>=5
psycopg~=3.1.17
pika>=0.12.0
pymongo~=3.1
PyMySQL~=0.9.3
pymongo~=4.6.3
PyMySQL~=1.1.1
pymssql~=2.3.2
pyramid>=1.7
redis>=2.6
remoulade>=0.50
sqlalchemy>=1.0
tornado>=5.1.1
tortoise-orm>=0.17.0
httpx>=0.18.0
# indirect dependency pins
markupsafe==2.0.1

View File

@ -40,6 +40,13 @@ instr_dirs = [
if isdir(join(instr, f))
]
instr_genai = "../instrumentation-genai"
instr_genai_dirs = [
os.path.abspath("/".join(["../instrumentation-genai", f, "src"]))
for f in listdir(instr_genai)
if isdir(join(instr_genai, f))
]
prop = "../propagator"
prop_dirs = [
os.path.abspath("/".join([prop, f, "src"]))
@ -60,7 +67,14 @@ resource_dirs = [
for f in listdir(resource)
if isdir(join(resource, f))
]
sys.path[:0] = exp_dirs + instr_dirs + sdk_ext_dirs + prop_dirs + resource_dirs
sys.path[:0] = (
exp_dirs
+ instr_dirs
+ instr_genai_dirs
+ sdk_ext_dirs
+ prop_dirs
+ resource_dirs
)
# -- Project information -----------------------------------------------------
@ -108,6 +122,7 @@ intersphinx_mapping = {
"https://opentelemetry-python.readthedocs.io/en/latest/",
None,
),
"redis": ("https://redis.readthedocs.io/en/latest/", None),
}
# http://www.sphinx-doc.org/en/master/config.html#confval-nitpicky

View File

@ -24,7 +24,7 @@ installed separately via pip:
pip install opentelemetry-instrumentation-{instrumentation}
pip install opentelemetry-sdk-extension-{sdk-extension}
A complete list of packages can be found at the
A complete list of packages can be found at the
`Contrib repo instrumentation <https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation>`_
and `Contrib repo exporter <https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter>`_ directories.
@ -50,8 +50,9 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
cd opentelemetry-python-contrib
pip install -e ./instrumentation/opentelemetry-instrumentation-flask
pip install -e ./instrumentation/opentelemetry-instrumentation-botocore
pip install -e ./instrumentation-genai/opentelemetry-instrumentation-openai-v2
pip install -e ./sdk-extension/opentelemetry-sdk-extension-aws
pip install -e ./resource/opentelemetry-resource-detector-container
pip install -e ./resource/opentelemetry-resource-detector-containerid
.. toctree::
@ -62,6 +63,14 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
instrumentation/**
.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Generative AI Instrumentations
:name: Generative AI Instrumentations
:glob:
instrumentation-genai/**
.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Propagators

View File

@ -0,0 +1,7 @@
OpenTelemetry Python - OpenAI Instrumentation
=============================================
.. automodule:: opentelemetry.instrumentation.openai_v2
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-aiohttp-server/README.rst
:end-before: References
.. automodule:: opentelemetry.instrumentation.aiohttp_server
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,10 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-aiokafka/README.rst
:end-before: References
API
---
.. automodule:: opentelemetry.instrumentation.aiokafka
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-asyncclick/README.rst
:end-before: References
.. automodule:: opentelemetry.instrumentation.asyncclick
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-click/README.rst
:end-before: References
.. automodule:: opentelemetry.instrumentation.click
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
OpenTelemetry pymssql Instrumentation
=====================================
.. automodule:: opentelemetry.instrumentation.pymssql
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,7 +1,10 @@
OpenTelemetry Redis Instrumentation
===================================
.. include:: ../../../instrumentation/opentelemetry-instrumentation-redis/README.rst
:end-before: References
Usage
-----
.. automodule:: opentelemetry.instrumentation.redis
:members:
:undoc-members:
:show-inheritance:
:show-inheritance:

View File

@ -0,0 +1,7 @@
OpenTelemetry Threading Instrumentation
=======================================
.. automodule:: opentelemetry.instrumentation.threading
:members:
:undoc-members:
:show-inheritance:

View File

@ -24,10 +24,14 @@ py-class=
httpx.Client
httpx.AsyncClient
httpx.BaseTransport
openai.BaseTransport
httpx.AsyncBaseTransport
httpx.SyncByteStream
httpx.AsyncByteStream
httpx.Response
httpx.URL
httpx.Headers
aiohttp.web_request.Request
yarl.URL
cimpl.Producer
cimpl.Consumer
@ -37,6 +41,10 @@ py-class=
callable
Consumer
confluent_kafka.Message
psycopg.Connection
psycopg.AsyncConnection
ObjectProxy
fastapi.applications.FastAPI
any=
; API
@ -64,7 +72,9 @@ any=
py-obj=
opentelemetry.propagators.textmap.CarrierT
opentelemetry.instrumentation.dbapi.ConnectionT
opentelemetry.instrumentation.dbapi.CursorT
py-func=
poll
flush

View File

@ -1,7 +1,7 @@
OpenTelemetry Python - Resource Detector for Containers
=======================================================
.. automodule:: opentelemetry.resource.detector.container
.. automodule:: opentelemetry.resource.detector.containerid
:members:
:undoc-members:
:show-inheritance:

View File

@ -16,7 +16,7 @@ sortfirst=
ext/*
[stable]
version=1.24.0.dev
version=1.36.0.dev
packages=
opentelemetry-sdk
@ -34,7 +34,7 @@ packages=
opentelemetry-api
[prerelease]
version=0.45b0.dev
version=0.57b0.dev
packages=
all
@ -43,18 +43,21 @@ packages=
opentelemetry-instrumentation
opentelemetry-contrib-instrumentations
opentelemetry-distro
opentelemetry-resource-detector-container
opentelemetry-resource-detector-containerid
[exclude_release]
packages=
opentelemetry-resource-detector-azure
opentelemetry-sdk-extension-aws
opentelemetry-propagator-aws-xray
opentelemetry-instrumentation-google-genai
opentelemetry-instrumentation-vertexai
opentelemetry-instrumentation-openai-v2
opentelemetry-instrumentation-test
[lintroots]
extraroots=examples/*,scripts/
subglob=*.py,tests/,test/,src/*,examples/*
ignore=sklearn
[testroots]
extraroots=examples/*,tests/

View File

@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.9
RUN apt-get update -y && apt-get install libsnappy-dev -y

View File

@ -1,3 +1,3 @@
## Instructions
1. Install protobuf tools. Can use your package manager or download from [GitHub](https://github.com/protocolbuffers/protobuf/releases/tag/v21.7)
2. Run `generate-proto-py.sh` from inside the `proto/` directory
1. Install protobuf tools. Can use your package manager or download from [GitHub](https://github.com/protocolbuffers/protobuf/releases/tag/v26.0)
2. Run `generate-proto-py.sh` from inside the `proto/` directory

View File

@ -6,7 +6,6 @@ PROTO_VERSION=v1.3.2
# SRC_DIR is from protoc perspective. ie its the destination for our checkouts/clones
SRC_DIR=opentelemetry/exporter/prometheus_remote_write/gen/
DST_DIR=../src/opentelemetry/exporter/prometheus_remote_write/gen/
#TODO:
# Check that black & protoc are installed properly
@ -50,7 +49,7 @@ sed -i 's/import "gogoproto\/gogo.proto";/import "opentelemetry\/exporter\/prome
echo "Removing clones..."
rm -rf protobuf prometheus
# Used libprotoc 3.21.1 & protoc 21.7
# Used libprotoc 26
echo "Compiling proto files to Python"
protoc -I . --python_out=../src ${SRC_DIR}/gogoproto/gogo.proto ${SRC_DIR}/remote.proto ${SRC_DIR}/types.proto

View File

@ -9,7 +9,7 @@ dynamic = ["version"]
description = "Prometheus Remote Write Metrics Exporter for OpenTelemetry"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
@ -19,12 +19,14 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"protobuf ~= 4.21",
"protobuf ~= 5.26",
"requests ~= 2.28",
"opentelemetry-api ~= 1.12",
"opentelemetry-sdk ~= 1.12",
@ -33,6 +35,7 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-prometheus-remote-write"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
[tool.hatch.version]
path = "src/opentelemetry/exporter/prometheus_remote_write/version.py"

View File

@ -16,7 +16,7 @@ import logging
import re
from collections import defaultdict
from itertools import chain
from typing import Dict, Sequence
from typing import Dict, Mapping, Sequence
import requests
import snappy
@ -29,14 +29,14 @@ from opentelemetry.exporter.prometheus_remote_write.gen.types_pb2 import ( # py
Sample,
TimeSeries,
)
from opentelemetry.sdk.metrics import Counter
from opentelemetry.sdk.metrics import Histogram as ClientHistogram
from opentelemetry.sdk.metrics import (
Counter,
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
UpDownCounter,
)
from opentelemetry.sdk.metrics import Histogram as ClientHistogram
from opentelemetry.sdk.metrics.export import (
AggregationTemporality,
Gauge,
@ -253,12 +253,14 @@ class PrometheusRemoteWriteMetricsExporter(MetricExporter):
return self._convert_to_timeseries(sample_sets, resource_labels)
def _convert_to_timeseries(
self, sample_sets: Sequence[tuple], resource_labels: Sequence
self, sample_sets: Mapping[tuple, Sequence], resource_labels: Sequence
) -> Sequence[TimeSeries]:
timeseries = []
for labels, samples in sample_sets.items():
ts = TimeSeries()
for label_name, label_value in chain(resource_labels, labels):
for label_name, label_value in sorted(
chain(resource_labels, labels)
):
# Previous implementation did not str() the names...
ts.labels.append(self._label(label_name, str(label_value)))
for value, timestamp in samples:

View File

@ -1,58 +1,45 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: opentelemetry/exporter/prometheus_remote_write/gen/remote.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from opentelemetry.exporter.prometheus_remote_write.gen import (
types_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_types__pb2,
)
from opentelemetry.exporter.prometheus_remote_write.gen.gogoproto import (
gogo_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_gogoproto_dot_gogo__pb2,
)
from opentelemetry.exporter.prometheus_remote_write.gen import types_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_types__pb2
from opentelemetry.exporter.prometheus_remote_write.gen.gogoproto import gogo_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_gogoproto_dot_gogo__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n?opentelemetry/exporter/prometheus_remote_write/gen/remote.proto\x12\nprometheus\x1a>opentelemetry/exporter/prometheus_remote_write/gen/types.proto\x1aGopentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo.proto"z\n\x0cWriteRequest\x12\x30\n\ntimeseries\x18\x01 \x03(\x0b\x32\x16.prometheus.TimeSeriesB\x04\xc8\xde\x1f\x00\x12\x32\n\x08metadata\x18\x03 \x03(\x0b\x32\x1a.prometheus.MetricMetadataB\x04\xc8\xde\x1f\x00J\x04\x08\x02\x10\x03"\xae\x01\n\x0bReadRequest\x12"\n\x07queries\x18\x01 \x03(\x0b\x32\x11.prometheus.Query\x12\x45\n\x17\x61\x63\x63\x65pted_response_types\x18\x02 \x03(\x0e\x32$.prometheus.ReadRequest.ResponseType"4\n\x0cResponseType\x12\x0b\n\x07SAMPLES\x10\x00\x12\x17\n\x13STREAMED_XOR_CHUNKS\x10\x01"8\n\x0cReadResponse\x12(\n\x07results\x18\x01 \x03(\x0b\x32\x17.prometheus.QueryResult"\x8f\x01\n\x05Query\x12\x1a\n\x12start_timestamp_ms\x18\x01 \x01(\x03\x12\x18\n\x10\x65nd_timestamp_ms\x18\x02 \x01(\x03\x12*\n\x08matchers\x18\x03 \x03(\x0b\x32\x18.prometheus.LabelMatcher\x12$\n\x05hints\x18\x04 \x01(\x0b\x32\x15.prometheus.ReadHints"9\n\x0bQueryResult\x12*\n\ntimeseries\x18\x01 \x03(\x0b\x32\x16.prometheus.TimeSeries"]\n\x13\x43hunkedReadResponse\x12\x31\n\x0e\x63hunked_series\x18\x01 \x03(\x0b\x32\x19.prometheus.ChunkedSeries\x12\x13\n\x0bquery_index\x18\x02 \x01(\x03\x42\x08Z\x06prompbb\x06proto3'
)
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n?opentelemetry/exporter/prometheus_remote_write/gen/remote.proto\x12\nprometheus\x1a>opentelemetry/exporter/prometheus_remote_write/gen/types.proto\x1aGopentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo.proto\"z\n\x0cWriteRequest\x12\x30\n\ntimeseries\x18\x01 \x03(\x0b\x32\x16.prometheus.TimeSeriesB\x04\xc8\xde\x1f\x00\x12\x32\n\x08metadata\x18\x03 \x03(\x0b\x32\x1a.prometheus.MetricMetadataB\x04\xc8\xde\x1f\x00J\x04\x08\x02\x10\x03\"\xae\x01\n\x0bReadRequest\x12\"\n\x07queries\x18\x01 \x03(\x0b\x32\x11.prometheus.Query\x12\x45\n\x17\x61\x63\x63\x65pted_response_types\x18\x02 \x03(\x0e\x32$.prometheus.ReadRequest.ResponseType\"4\n\x0cResponseType\x12\x0b\n\x07SAMPLES\x10\x00\x12\x17\n\x13STREAMED_XOR_CHUNKS\x10\x01\"8\n\x0cReadResponse\x12(\n\x07results\x18\x01 \x03(\x0b\x32\x17.prometheus.QueryResult\"\x8f\x01\n\x05Query\x12\x1a\n\x12start_timestamp_ms\x18\x01 \x01(\x03\x12\x18\n\x10\x65nd_timestamp_ms\x18\x02 \x01(\x03\x12*\n\x08matchers\x18\x03 \x03(\x0b\x32\x18.prometheus.LabelMatcher\x12$\n\x05hints\x18\x04 \x01(\x0b\x32\x15.prometheus.ReadHints\"9\n\x0bQueryResult\x12*\n\ntimeseries\x18\x01 \x03(\x0b\x32\x16.prometheus.TimeSeries\"]\n\x13\x43hunkedReadResponse\x12\x31\n\x0e\x63hunked_series\x18\x01 \x03(\x0b\x32\x19.prometheus.ChunkedSeries\x12\x13\n\x0bquery_index\x18\x02 \x01(\x03\x42\x08Z\x06prompbb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(
DESCRIPTOR,
"opentelemetry.exporter.prometheus_remote_write.gen.remote_pb2",
globals(),
)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b"Z\006prompb"
_WRITEREQUEST.fields_by_name["timeseries"]._options = None
_WRITEREQUEST.fields_by_name[
"timeseries"
]._serialized_options = b"\310\336\037\000"
_WRITEREQUEST.fields_by_name["metadata"]._options = None
_WRITEREQUEST.fields_by_name[
"metadata"
]._serialized_options = b"\310\336\037\000"
_WRITEREQUEST._serialized_start = 216
_WRITEREQUEST._serialized_end = 338
_READREQUEST._serialized_start = 341
_READREQUEST._serialized_end = 515
_READREQUEST_RESPONSETYPE._serialized_start = 463
_READREQUEST_RESPONSETYPE._serialized_end = 515
_READRESPONSE._serialized_start = 517
_READRESPONSE._serialized_end = 573
_QUERY._serialized_start = 576
_QUERY._serialized_end = 719
_QUERYRESULT._serialized_start = 721
_QUERYRESULT._serialized_end = 778
_CHUNKEDREADRESPONSE._serialized_start = 780
_CHUNKEDREADRESPONSE._serialized_end = 873
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'opentelemetry.exporter.prometheus_remote_write.gen.remote_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
_globals['DESCRIPTOR']._loaded_options = None
_globals['DESCRIPTOR']._serialized_options = b'Z\006prompb'
_globals['_WRITEREQUEST'].fields_by_name['timeseries']._loaded_options = None
_globals['_WRITEREQUEST'].fields_by_name['timeseries']._serialized_options = b'\310\336\037\000'
_globals['_WRITEREQUEST'].fields_by_name['metadata']._loaded_options = None
_globals['_WRITEREQUEST'].fields_by_name['metadata']._serialized_options = b'\310\336\037\000'
_globals['_WRITEREQUEST']._serialized_start=216
_globals['_WRITEREQUEST']._serialized_end=338
_globals['_READREQUEST']._serialized_start=341
_globals['_READREQUEST']._serialized_end=515
_globals['_READREQUEST_RESPONSETYPE']._serialized_start=463
_globals['_READREQUEST_RESPONSETYPE']._serialized_end=515
_globals['_READRESPONSE']._serialized_start=517
_globals['_READRESPONSE']._serialized_end=573
_globals['_QUERY']._serialized_start=576
_globals['_QUERY']._serialized_end=719
_globals['_QUERYRESULT']._serialized_start=721
_globals['_QUERYRESULT']._serialized_end=778
_globals['_CHUNKEDREADRESPONSE']._serialized_start=780
_globals['_CHUNKEDREADRESPONSE']._serialized_end=873
# @@protoc_insertion_point(module_scope)

View File

@ -1,85 +1,66 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: opentelemetry/exporter/prometheus_remote_write/gen/types.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from opentelemetry.exporter.prometheus_remote_write.gen.gogoproto import (
gogo_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_gogoproto_dot_gogo__pb2,
)
from opentelemetry.exporter.prometheus_remote_write.gen.gogoproto import gogo_pb2 as opentelemetry_dot_exporter_dot_prometheus__remote__write_dot_gen_dot_gogoproto_dot_gogo__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n>opentelemetry/exporter/prometheus_remote_write/gen/types.proto\x12\nprometheus\x1aGopentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo.proto"\xf8\x01\n\x0eMetricMetadata\x12\x33\n\x04type\x18\x01 \x01(\x0e\x32%.prometheus.MetricMetadata.MetricType\x12\x1a\n\x12metric_family_name\x18\x02 \x01(\t\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0c\n\x04unit\x18\x05 \x01(\t"y\n\nMetricType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07\x43OUNTER\x10\x01\x12\t\n\x05GAUGE\x10\x02\x12\r\n\tHISTOGRAM\x10\x03\x12\x12\n\x0eGAUGEHISTOGRAM\x10\x04\x12\x0b\n\x07SUMMARY\x10\x05\x12\x08\n\x04INFO\x10\x06\x12\x0c\n\x08STATESET\x10\x07"*\n\x06Sample\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x11\n\ttimestamp\x18\x02 \x01(\x03"U\n\x08\x45xemplar\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12\r\n\x05value\x18\x02 \x01(\x01\x12\x11\n\ttimestamp\x18\x03 \x01(\x03"\x8f\x01\n\nTimeSeries\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12)\n\x07samples\x18\x02 \x03(\x0b\x32\x12.prometheus.SampleB\x04\xc8\xde\x1f\x00\x12-\n\texemplars\x18\x03 \x03(\x0b\x32\x14.prometheus.ExemplarB\x04\xc8\xde\x1f\x00"$\n\x05Label\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"1\n\x06Labels\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00"\x82\x01\n\x0cLabelMatcher\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.prometheus.LabelMatcher.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t"(\n\x04Type\x12\x06\n\x02\x45Q\x10\x00\x12\x07\n\x03NEQ\x10\x01\x12\x06\n\x02RE\x10\x02\x12\x07\n\x03NRE\x10\x03"|\n\tReadHints\x12\x0f\n\x07step_ms\x18\x01 \x01(\x03\x12\x0c\n\x04\x66unc\x18\x02 \x01(\t\x12\x10\n\x08start_ms\x18\x03 \x01(\x03\x12\x0e\n\x06\x65nd_ms\x18\x04 \x01(\x03\x12\x10\n\x08grouping\x18\x05 \x03(\t\x12\n\n\x02\x62y\x18\x06 \x01(\x08\x12\x10\n\x08range_ms\x18\x07 \x01(\x03"\x8b\x01\n\x05\x43hunk\x12\x13\n\x0bmin_time_ms\x18\x01 \x01(\x03\x12\x13\n\x0bmax_time_ms\x18\x02 \x01(\x03\x12(\n\x04type\x18\x03 \x01(\x0e\x32\x1a.prometheus.Chunk.Encoding\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c" \n\x08\x45ncoding\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03XOR\x10\x01"a\n\rChunkedSeries\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12\'\n\x06\x63hunks\x18\x02 \x03(\x0b\x32\x11.prometheus.ChunkB\x04\xc8\xde\x1f\x00\x42\x08Z\x06prompbb\x06proto3'
)
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n>opentelemetry/exporter/prometheus_remote_write/gen/types.proto\x12\nprometheus\x1aGopentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo.proto\"\xf8\x01\n\x0eMetricMetadata\x12\x33\n\x04type\x18\x01 \x01(\x0e\x32%.prometheus.MetricMetadata.MetricType\x12\x1a\n\x12metric_family_name\x18\x02 \x01(\t\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0c\n\x04unit\x18\x05 \x01(\t\"y\n\nMetricType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07\x43OUNTER\x10\x01\x12\t\n\x05GAUGE\x10\x02\x12\r\n\tHISTOGRAM\x10\x03\x12\x12\n\x0eGAUGEHISTOGRAM\x10\x04\x12\x0b\n\x07SUMMARY\x10\x05\x12\x08\n\x04INFO\x10\x06\x12\x0c\n\x08STATESET\x10\x07\"*\n\x06Sample\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x11\n\ttimestamp\x18\x02 \x01(\x03\"U\n\x08\x45xemplar\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12\r\n\x05value\x18\x02 \x01(\x01\x12\x11\n\ttimestamp\x18\x03 \x01(\x03\"\x8f\x01\n\nTimeSeries\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12)\n\x07samples\x18\x02 \x03(\x0b\x32\x12.prometheus.SampleB\x04\xc8\xde\x1f\x00\x12-\n\texemplars\x18\x03 \x03(\x0b\x32\x14.prometheus.ExemplarB\x04\xc8\xde\x1f\x00\"$\n\x05Label\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"1\n\x06Labels\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\"\x82\x01\n\x0cLabelMatcher\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.prometheus.LabelMatcher.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\"(\n\x04Type\x12\x06\n\x02\x45Q\x10\x00\x12\x07\n\x03NEQ\x10\x01\x12\x06\n\x02RE\x10\x02\x12\x07\n\x03NRE\x10\x03\"|\n\tReadHints\x12\x0f\n\x07step_ms\x18\x01 \x01(\x03\x12\x0c\n\x04\x66unc\x18\x02 \x01(\t\x12\x10\n\x08start_ms\x18\x03 \x01(\x03\x12\x0e\n\x06\x65nd_ms\x18\x04 \x01(\x03\x12\x10\n\x08grouping\x18\x05 \x03(\t\x12\n\n\x02\x62y\x18\x06 \x01(\x08\x12\x10\n\x08range_ms\x18\x07 \x01(\x03\"\x8b\x01\n\x05\x43hunk\x12\x13\n\x0bmin_time_ms\x18\x01 \x01(\x03\x12\x13\n\x0bmax_time_ms\x18\x02 \x01(\x03\x12(\n\x04type\x18\x03 \x01(\x0e\x32\x1a.prometheus.Chunk.Encoding\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c\" \n\x08\x45ncoding\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03XOR\x10\x01\"a\n\rChunkedSeries\x12\'\n\x06labels\x18\x01 \x03(\x0b\x32\x11.prometheus.LabelB\x04\xc8\xde\x1f\x00\x12\'\n\x06\x63hunks\x18\x02 \x03(\x0b\x32\x11.prometheus.ChunkB\x04\xc8\xde\x1f\x00\x42\x08Z\x06prompbb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(
DESCRIPTOR,
"opentelemetry.exporter.prometheus_remote_write.gen.types_pb2",
globals(),
)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b"Z\006prompb"
_EXEMPLAR.fields_by_name["labels"]._options = None
_EXEMPLAR.fields_by_name[
"labels"
]._serialized_options = b"\310\336\037\000"
_TIMESERIES.fields_by_name["labels"]._options = None
_TIMESERIES.fields_by_name[
"labels"
]._serialized_options = b"\310\336\037\000"
_TIMESERIES.fields_by_name["samples"]._options = None
_TIMESERIES.fields_by_name[
"samples"
]._serialized_options = b"\310\336\037\000"
_TIMESERIES.fields_by_name["exemplars"]._options = None
_TIMESERIES.fields_by_name[
"exemplars"
]._serialized_options = b"\310\336\037\000"
_LABELS.fields_by_name["labels"]._options = None
_LABELS.fields_by_name["labels"]._serialized_options = b"\310\336\037\000"
_CHUNKEDSERIES.fields_by_name["labels"]._options = None
_CHUNKEDSERIES.fields_by_name[
"labels"
]._serialized_options = b"\310\336\037\000"
_CHUNKEDSERIES.fields_by_name["chunks"]._options = None
_CHUNKEDSERIES.fields_by_name[
"chunks"
]._serialized_options = b"\310\336\037\000"
_METRICMETADATA._serialized_start = 152
_METRICMETADATA._serialized_end = 400
_METRICMETADATA_METRICTYPE._serialized_start = 279
_METRICMETADATA_METRICTYPE._serialized_end = 400
_SAMPLE._serialized_start = 402
_SAMPLE._serialized_end = 444
_EXEMPLAR._serialized_start = 446
_EXEMPLAR._serialized_end = 531
_TIMESERIES._serialized_start = 534
_TIMESERIES._serialized_end = 677
_LABEL._serialized_start = 679
_LABEL._serialized_end = 715
_LABELS._serialized_start = 717
_LABELS._serialized_end = 766
_LABELMATCHER._serialized_start = 769
_LABELMATCHER._serialized_end = 899
_LABELMATCHER_TYPE._serialized_start = 859
_LABELMATCHER_TYPE._serialized_end = 899
_READHINTS._serialized_start = 901
_READHINTS._serialized_end = 1025
_CHUNK._serialized_start = 1028
_CHUNK._serialized_end = 1167
_CHUNK_ENCODING._serialized_start = 1135
_CHUNK_ENCODING._serialized_end = 1167
_CHUNKEDSERIES._serialized_start = 1169
_CHUNKEDSERIES._serialized_end = 1266
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'opentelemetry.exporter.prometheus_remote_write.gen.types_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
_globals['DESCRIPTOR']._loaded_options = None
_globals['DESCRIPTOR']._serialized_options = b'Z\006prompb'
_globals['_EXEMPLAR'].fields_by_name['labels']._loaded_options = None
_globals['_EXEMPLAR'].fields_by_name['labels']._serialized_options = b'\310\336\037\000'
_globals['_TIMESERIES'].fields_by_name['labels']._loaded_options = None
_globals['_TIMESERIES'].fields_by_name['labels']._serialized_options = b'\310\336\037\000'
_globals['_TIMESERIES'].fields_by_name['samples']._loaded_options = None
_globals['_TIMESERIES'].fields_by_name['samples']._serialized_options = b'\310\336\037\000'
_globals['_TIMESERIES'].fields_by_name['exemplars']._loaded_options = None
_globals['_TIMESERIES'].fields_by_name['exemplars']._serialized_options = b'\310\336\037\000'
_globals['_LABELS'].fields_by_name['labels']._loaded_options = None
_globals['_LABELS'].fields_by_name['labels']._serialized_options = b'\310\336\037\000'
_globals['_CHUNKEDSERIES'].fields_by_name['labels']._loaded_options = None
_globals['_CHUNKEDSERIES'].fields_by_name['labels']._serialized_options = b'\310\336\037\000'
_globals['_CHUNKEDSERIES'].fields_by_name['chunks']._loaded_options = None
_globals['_CHUNKEDSERIES'].fields_by_name['chunks']._serialized_options = b'\310\336\037\000'
_globals['_METRICMETADATA']._serialized_start=152
_globals['_METRICMETADATA']._serialized_end=400
_globals['_METRICMETADATA_METRICTYPE']._serialized_start=279
_globals['_METRICMETADATA_METRICTYPE']._serialized_end=400
_globals['_SAMPLE']._serialized_start=402
_globals['_SAMPLE']._serialized_end=444
_globals['_EXEMPLAR']._serialized_start=446
_globals['_EXEMPLAR']._serialized_end=531
_globals['_TIMESERIES']._serialized_start=534
_globals['_TIMESERIES']._serialized_end=677
_globals['_LABEL']._serialized_start=679
_globals['_LABEL']._serialized_end=715
_globals['_LABELS']._serialized_start=717
_globals['_LABELS']._serialized_end=766
_globals['_LABELMATCHER']._serialized_start=769
_globals['_LABELMATCHER']._serialized_end=899
_globals['_LABELMATCHER_TYPE']._serialized_start=859
_globals['_LABELMATCHER_TYPE']._serialized_end=899
_globals['_READHINTS']._serialized_start=901
_globals['_READHINTS']._serialized_end=1025
_globals['_CHUNK']._serialized_start=1028
_globals['_CHUNK']._serialized_end=1167
_globals['_CHUNK_ENCODING']._serialized_start=1135
_globals['_CHUNK_ENCODING']._serialized_end=1167
_globals['_CHUNKEDSERIES']._serialized_start=1169
_globals['_CHUNKEDSERIES']._serialized_end=1266
# @@protoc_insertion_point(module_scope)

View File

@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.45b0.dev"
__version__ = "0.57b0.dev"

View File

@ -1,24 +1,20 @@
asgiref==3.7.2
attrs==23.2.0
certifi==2024.2.2
asgiref==3.8.1
certifi==2024.7.4
charset-normalizer==3.3.2
cramjam==2.8.1
cramjam==2.8.4
Deprecated==1.2.14
idna==3.6
importlib-metadata==6.11.0
idna==3.7
iniconfig==2.0.0
packaging==23.2
pluggy==1.4.0
protobuf==4.25.3
py==1.11.0
packaging==24.0
pluggy==1.5.0
protobuf==5.26
py-cpuinfo==9.0.0
pytest==7.1.3
pytest-benchmark==4.0.0
pytest==7.4.4
python-snappy==0.7.1
requests==2.31.0
requests==2.32.3
tomli==2.0.1
typing_extensions==4.10.0
urllib3==2.2.1
typing_extensions==4.12.2
urllib3==2.2.2
wrapt==1.16.0
zipp==3.17.0
zipp==3.19.2
-e exporter/opentelemetry-exporter-prometheus-remote-write

View File

@ -22,6 +22,8 @@ from opentelemetry.exporter.prometheus_remote_write import (
PrometheusRemoteWriteMetricsExporter,
)
from opentelemetry.exporter.prometheus_remote_write.gen.types_pb2 import ( # pylint: disable=E0611
Label,
Sample,
TimeSeries,
)
from opentelemetry.sdk.metrics.export import (
@ -155,6 +157,38 @@ def test_parse_metric(metric, prom_rw):
assert sample.value in values
def test_convert_to_timeseries(prom_rw):
resource_labels = (("service_name", "foo"), ("bool_value", True))
sample_sets = {
(("foo", "bar"), ("baz", 42), ("__name__", "test_histogram_tu")): [
(1, 1641946016139)
],
(("baz", "42"), ("foo", "bar")): [(4, 1641946016139)],
}
timeseries = prom_rw._convert_to_timeseries(sample_sets, resource_labels)
assert timeseries == [
TimeSeries(
labels=[
Label(name="__name__", value="test_histogram_tu"),
Label(name="baz", value="42"),
Label(name="bool_value", value="True"),
Label(name="foo", value="bar"),
Label(name="service_name", value="foo"),
],
samples=[Sample(value=1, timestamp=1641946016139)],
),
TimeSeries(
labels=[
Label(name="baz", value="42"),
Label(name="bool_value", value="True"),
Label(name="foo", value="bar"),
Label(name="service_name", value="foo"),
],
samples=[Sample(value=4, timestamp=1641946016139)],
),
]
class TestValidation(unittest.TestCase):
# Test cases to ensure exporter parameter validation works as intended
def test_valid_standard_param(self):

View File

@ -8,7 +8,7 @@ dynamic = ["version"]
description = "Rich Console Exporter for OpenTelemetry"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
@ -18,20 +18,22 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-sdk ~= 1.12",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.57b0.dev",
"rich>=10.0.0",
]
[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-richconsole"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
[tool.hatch.version]
path = "src/opentelemetry/exporter/richconsole/version.py"

View File

@ -64,11 +64,15 @@ from rich.tree import Tree
import opentelemetry.trace
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.semconv._incubating.attributes.db_attributes import (
DB_STATEMENT,
)
def _ns_to_time(nanoseconds):
ts = datetime.datetime.utcfromtimestamp(nanoseconds / 1e9)
ts = datetime.datetime.fromtimestamp(
nanoseconds / 1e9, datetime.timezone.utc
)
return ts.strftime("%H:%M:%S.%f")
@ -118,7 +122,7 @@ def _child_add_optional_attributes(child: Tree, span: ReadableSpan):
label=Text.from_markup("[bold cyan]Attributes :[/bold cyan] ")
)
for attribute in span.attributes:
if attribute == SpanAttributes.DB_STATEMENT:
if attribute == DB_STATEMENT:
attributes.add(
Text.from_markup(f"[bold cyan]{attribute} :[/bold cyan] ")
)

View File

@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.45b0.dev"
__version__ = "0.57b0.dev"

View File

@ -1,21 +1,17 @@
asgiref==3.7.2
attrs==23.2.0
asgiref==3.8.1
Deprecated==1.2.14
flaky==3.7.0
importlib-metadata==6.11.0
iniconfig==2.0.0
markdown-it-py==3.0.0
mdurl==0.1.2
packaging==23.2
pluggy==1.4.0
py==1.11.0
packaging==24.0
pluggy==1.5.0
py-cpuinfo==9.0.0
Pygments==2.17.2
pytest==7.1.3
pytest-benchmark==4.0.0
pytest==7.4.4
rich==13.7.1
tomli==2.0.1
typing_extensions==4.10.0
typing_extensions==4.12.2
wrapt==1.16.0
zipp==3.17.0
zipp==3.19.2
-e exporter/opentelemetry-exporter-richconsole

View File

@ -1,9 +1,8 @@
-c dev-requirements.txt
astor==0.8.1
jinja2~=2.7
jinja2==3.1.6
markupsafe==2.0.1
isort
black
ruff==0.6.9
requests
tomli
tomli_w

View File

@ -0,0 +1,6 @@
| Instrumentation | Supported Packages | Metrics support | Semconv status |
| --------------- | ------------------ | --------------- | -------------- |
| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.0.0 | No | development
| [opentelemetry-instrumentation-openai-v2](./opentelemetry-instrumentation-openai-v2) | openai >= 1.26.0 | Yes | development
| [opentelemetry-instrumentation-vertexai](./opentelemetry-instrumentation-vertexai) | google-cloud-aiplatform >= 1.64 | No | development

View File

@ -0,0 +1,4 @@
.build
.test
dist

View File

@ -0,0 +1,28 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## Version 0.3b0 (2025-07-08)
- Add automatic instrumentation to tool call functions ([#3446](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3446))
## Version 0.2b0 (2025-04-28)
- Add more request configuration options to the span attributes ([#3374](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3374))
- Restructure tests to keep in line with repository conventions ([#3344](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3344))
- Fix [bug](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3416) where
span attribute `gen_ai.response.finish_reasons` is empty ([#3417](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3417))
## Version 0.1b0 (2025-03-05)
- Add support for async and streaming.
([#3298](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3298))
Create an initial version of Open Telemetry instrumentation for github.com/googleapis/python-genai.
([#3256](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3256))

View File

@ -0,0 +1,203 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,92 @@
OpenTelemetry Google GenAI SDK Instrumentation
==============================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-google-genai.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-google-genai/
This library adds instrumentation to the `Google GenAI SDK library <https://pypi.org/project/google-genai/>`_
to emit telemetry data following `Semantic Conventions for GenAI systems <https://opentelemetry.io/docs/specs/semconv/gen-ai/>`_.
It adds trace spans for GenAI operations, events/logs for recording prompts/responses, and emits metrics that describe the
GenAI operations in aggregate.
Experimental
------------
This package is still experimental. The instrumentation may not be complete or correct just yet.
Please see "TODOS.md" for a list of known defects/TODOs that are blockers to package stability.
Installation
------------
If your application is already instrumented with OpenTelemetry, add this
package to your requirements.
::
pip install opentelemetry-instrumentation-google-genai
If you don't have a Google GenAI SDK application, yet, try our `examples <examples>`_.
Check out `zero-code example <examples/zero-code>`_ for a quick start.
Usage
-----
This section describes how to set up Google GenAI SDK instrumentation if you're setting OpenTelemetry up manually.
Check out the `manual example <examples/manual>`_ for more details.
Instrumenting all clients
*************************
When using the instrumentor, all clients will automatically trace GenAI `generate_content` operations.
You can also optionally capture prompts and responses as log events.
Make sure to configure OpenTelemetry tracing, logging, metrics, and events to capture all telemetry emitted by the instrumentation.
.. code-block:: python
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
from google.genai import Client
GoogleGenAiSdkInstrumentor().instrument()
client = Client()
response = client.models.generate_content(
model="gemini-1.5-flash-002",
contents="Write a short poem on OpenTelemetry.")
Enabling message content
*************************
Message content such as the contents of the prompt and response
are not captured by default. To capture message content as log events, set the environment variable
`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` to `true`.
Uninstrument
************
To uninstrument clients, call the uninstrument method:
.. code-block:: python
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
GoogleGenAiSdkInstrumentor().instrument()
# ...
# Uninstrument all clients
GoogleGenAiSdkInstrumentor().uninstrument()
References
----------
* `Google Gen AI SDK Documentation <https://ai.google.dev/gemini-api/docs/sdks>`_
* `Google Gen AI SDK on GitHub <https://github.com/googleapis/python-genai>`_
* `Using Vertex AI with Google Gen AI SDK <https://cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
* `OpenTelemetry Python Examples <https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples>`_

View File

@ -0,0 +1,19 @@
# TODOs
## Fundamentals
Here are some TODO items required to achieve stability for this package:
- Add more span-level attributes for response information
- Verify and correct formatting of events:
- Including the 'role' field for message events
- Including tool invocation information
- Emit events for safety ratings when they block responses
- Additional cleanup/improvement tasks such as:
- Adoption of 'wrapt' instead of 'functools.wraps'
- Bolstering test coverage
## Future
Beyond the above TODOs, it would also be desirable to extend the
instrumentation beyond `generate_content` to other API surfaces.

View File

@ -0,0 +1,28 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Uncomment and change to your OTLP endpoint
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# OTEL_EXPORTER_OTLP_PROTOCOL=grpc
# Uncomment to change parameters used to configure 'google.genai'
# GOOGLE_GENAI_USE_VERTEXAI=1
# GOOGLE_API_KEY=<your api key>
# GOOGLE_CLOUD_PROJECT=<your cloud project>
# GOOGLE_CLOUD_LOCATION=<your cloud location>
OTEL_SERVICE_NAME=opentelemetry-python-google-genai
# Change to 'false' to hide prompt and completion content
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

View File

@ -0,0 +1,44 @@
OpenTelemetry Google GenAI SDK Manual Instrumentation Example
============================================
This is an example of how to instrument Google GenAI SDK calls when configuring
OpenTelemetry SDK and Instrumentations manually.
When `main.py <main.py>`_ is run, it exports traces, logs, and metrics to an OTLP
compatible endpoint. Traces include details such as the model used and the
duration of the chat request. Logs capture the chat request and the generated
response, providing a comprehensive view of the performance and behavior of
your GenAI SDK requests. Metrics include aggregate statistics such as the aggregate
token usage as well as the latency distribution of the GenAI operations.
Note: `.env <.env>`_ file configures additional environment variables:
- `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`
... configures Google GenAI SDK instrumentation to capture prompt/response content.
Setup
-----
An OTLP compatible endpoint should be listening for traces, logs, and metrics on
http://localhost:4317. If not, update "OTEL_EXPORTER_OTLP_ENDPOINT" as well.
Next, set up a virtual environment like this:
::
python3 -m venv .venv
source .venv/bin/activate
pip install "python-dotenv[cli]"
pip install -r requirements.txt
Run
---
Run the example like this:
::
export PROMPT="Your prompt here"
dotenv run -- python main.py

View File

@ -0,0 +1,101 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# We skip linting this file with pylint, because the linter is not
# configured with the "requirements.txt" dependencies and therefore
# will give multiple "no-name-in-module" errors for the imports.
#
# pylint: skip-file
import os
import google.genai
# NOTE: OpenTelemetry Python Logs and Events APIs are in beta
from opentelemetry import _events as otel_events
from opentelemetry import _logs as otel_logs
from opentelemetry import metrics as otel_metrics
from opentelemetry import trace as otel_trace
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import (
OTLPLogExporter,
)
from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import (
OTLPMetricExporter,
)
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
OTLPSpanExporter,
)
from opentelemetry.instrumentation.google_genai import (
GoogleGenAiSdkInstrumentor,
)
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.sdk._events import EventLoggerProvider
from opentelemetry.sdk._logs import LoggerProvider
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
def setup_otel_tracing():
otel_trace.set_tracer_provider(TracerProvider())
otel_trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(OTLPSpanExporter())
)
def setup_otel_logs_and_events():
otel_logs.set_logger_provider(LoggerProvider())
otel_logs.get_logger_provider().add_log_record_processor(
BatchLogRecordProcessor(OTLPLogExporter())
)
otel_events.set_event_logger_provider(EventLoggerProvider())
def setup_otel_metrics():
meter_provider = MeterProvider(
metric_readers=[
PeriodicExportingMetricReader(
OTLPMetricExporter(),
),
]
)
otel_metrics.set_meter_provider(meter_provider)
def setup_opentelemetry():
setup_otel_tracing()
setup_otel_logs_and_events()
setup_otel_metrics()
def instrument_google_genai():
GoogleGenAiSdkInstrumentor().instrument()
RequestsInstrumentor().instrument()
def main():
setup_opentelemetry()
instrument_google_genai()
client = google.genai.Client()
response = client.models.generate_content(
model=os.getenv("MODEL", "gemini-2.0-flash-001"),
contents=os.getenv("PROMPT", "Why is the sky blue?"),
)
print(response.text)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,20 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
google-genai ~= 1.0.0
opentelemetry-api ~= 1.30.0
opentelemetry-sdk ~= 1.30.0
opentelemetry-exporter-otlp-proto-grpc ~= 1.30.0
opentelemetry-instrumentation-requests ~= 0.51b0
opentelemetry-instrumentation-google-genai ~= 0.0.1.dev

View File

@ -0,0 +1,30 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Update to change exporter configuration as desired.
# See: https://opentelemetry.io/docs/zero-code/python/configuration/
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
# Uncomment to change parameters used to configure 'google.genai'
# GOOGLE_GENAI_USE_VERTEXAI=1
# GOOGLE_API_KEY=<your api key>
# GOOGLE_CLOUD_PROJECT=<your cloud project>
# GOOGLE_CLOUD_LOCATION=<your cloud location>
OTEL_SERVICE_NAME=opentelemetry-python-google-genai
# Change to 'false' to hide prompt and completion content
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

View File

@ -0,0 +1,46 @@
OpenTelemetry Google GenAI SDK Manual Instrumentation Example
============================================
This is an example of how to instrument Google GenAI SDK calls with zero code changes,
using `opentelemetryh-instrument`.
When `main.py <main.py>`_ is run, it exports traces, logs, and metrics to an OTLP
compatible endpoint. Traces include details such as the model used and the
duration of the chat request. Logs capture the chat request and the generated
response, providing a comprehensive view of the performance and behavior of
your GenAI SDK requests. Metrics include aggregate statistics such as the aggregate
token usage as well as the latency distribution of the GenAI operations.
Note: `.env <.env>`_ file configures additional environment variables:
- `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`
... configures Google GenAI SDK instrumentation to capture prompt/response content.
Setup
-----
An OTLP compatible endpoint should be listening for traces, logs, and metrics on
http://localhost:4317. If not, update "OTEL_EXPORTER_OTLP_ENDPOINT" as well.
Next, set up a virtual environment like this:
::
python3 -m venv .venv
source .venv/bin/activate
pip install "python-dotenv[cli]"
pip install -r requirements.txt
opentelemetry-bootstrap -a install
Run
---
Run the example like this:
::
export PROMPT="Your prompt here"
dotenv run -- opentelemetry-instrument python main.py

View File

@ -0,0 +1,30 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import google.genai
def main():
client = google.genai.Client()
response = client.models.generate_content(
model=os.getenv("MODEL", "gemini-2.0-flash-001"),
contents=os.getenv("PROMPT", "Why is the sky blue?"),
)
print(response.text)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,23 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
google-genai ~= 1.0.0
opentelemetry-api ~= 1.30.0
opentelemetry-sdk ~= 1.30.0
opentelemetry-exporter-otlp-proto-grpc ~= 1.30.0
opentelemetry-instrumentation ~= 0.51b0
opentelemetry-instrumentation-requests ~= 0.51b0
opentelemetry-instrumentation-google-genai ~= 0.0.1.dev
opentelemetry-contrib-instrumentations ~= 0.51b0
opentelemetry-distro[otlp] ~= 0.51b0

View File

@ -0,0 +1,79 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "opentelemetry-instrumentation-google-genai"
dynamic = ["version"]
description = "OpenTelemetry"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]
dependencies = [
"opentelemetry-api >=1.31.1, <2",
"opentelemetry-instrumentation >=0.52b1, <2",
"opentelemetry-semantic-conventions >=0.52b1, <2"
]
[project.optional-dependencies]
instruments = [
"google-genai >= 1.0.0"
]
[project.entry-points.opentelemetry_instrumentor]
google-genai = "opentelemetry.instrumentation.google_genai:GoogleGenAiSdkInstrumentor"
[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-google-genai"
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
[tool.hatch.version]
path = "src/opentelemetry/instrumentation/google_genai/version.py"
[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]
[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]
[tool.pyright]
include = [
"src",
]
exclude = [
"**/__pycache__",
]
stubPath = "types"
reportMissingImports = "error"
reportMissingTypeStubs = false
pythonVersion = "3.9"

Some files were not shown because too many files have changed in this diff Show More