Compare commits

...

1172 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
Tammy Baylis 37aba928d4
Add cloud.account.id attribute by AwsLambdaInstrumentor (#2367)
* Add cloud.account.id attribute by AwsLambdaInstrumentor

* Changelog

* Update test

* lint
2024-03-22 17:46:10 -06:00
samypr100 d06de3f9f1
regression-fix: retain httpx.URL type on request.url (#2359)
* fix: retain httpx.URL type on request.url

This fixes a regression caused in #2020 where request.url stopped being of `httpx.URL` type, causing issues with request/response hooks.

* Update CHANGELOG.md

* tests: adding assertions to verify request.url on hooks is a httpx.URL

* fixup: adjust check to consider httpx < 0.20.0

* fixup: keep code dry

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2024-03-22 17:15:51 -06:00
Riccardo Magliocchetti ca082a7c52
elasticsearch: don't set body as db statement for bulk requests (#2355)
* elasticsearch: don't set body as db statement for bulk requests

bulk requests can be too big and diverse to make sense as db statement.
Other than that the sanitizer currently only handles dicts so it's
crashing.

Closes #2150

Co-authored-by: Jason Mobarak <git@jason.mobarak.name>
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>

* Update CHANGELOG

* Please the linter

---------

Co-authored-by: Jason Mobarak <git@jason.mobarak.name>
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
2024-03-22 16:56:29 -06:00
Diego Hurtado ada27842bd
Remove [test] package from pika instrumentation (#2306)
Fixes #2209
2024-03-21 23:31:47 -06:00
Diego Hurtado 96655cefbc
Remove [test] package from _template (#2329)
Fixes #2328
2024-03-22 05:06:44 +00:00
Diego Hurtado 86a552ecc8
Remove [test] package from boto3sqs instrumentation (#2252)
Fixes #2192
2024-03-22 04:39:20 +00:00
Diego Hurtado 26479c8a34
Remove [test] package from pymysql instrumentation (#2272)
Fixes #2272
2024-03-22 04:21:36 +00:00
Diego Hurtado 4360b5f6e8
Remove [test] package from confluent-kafka instrumentation (#2287)
Fixes #2196
2024-03-21 21:55:43 -06:00
Diego Hurtado c8889d7211
Remove [test] package from tortoiseorm instrumentation (#2281)
Fixes #2224
2024-03-21 21:39:57 -06:00
Diego Hurtado 0e66ef6e20
Remove [test] package from system-metrics instrumentation (#2279)
Fixes #2222
2024-03-21 21:25:18 -06:00
Diego Hurtado 9cf995c62e
Remove [test] package from sqlite3 instrumentation (#2277)
Fixes #2220
2024-03-21 20:53:30 -06:00
Diego Hurtado 35cb8c5254
Remove [test] package from distro (#2325)
Fixes #2237
2024-03-22 01:59:31 +00:00
Diego Hurtado 4bb095e961
Remove [test] package from opentelemetry-instrumentation (#2327)
Fixes #2235
2024-03-21 19:31:51 -06:00
Diego Hurtado 24c1ccabc5
Remove [test] package from sdk-extension-aws (#2324)
Fixes #2234
2024-03-21 19:16:41 -06:00
Diego Hurtado bc734282b9
Remove [test] package from exporter-prometheus-remote-write (#2323)
Fixes #2233
2024-03-21 18:01:24 -06:00
Diego Hurtado 69fbfd6080
Remove [test] package from exporter-richconsole (#2322)
Fixes #2232
2024-03-21 17:45:12 -06:00
Diego Hurtado dc62f8de49
Remove [test] package from propagator-ot-trace (#2321)
Fixes #2231
2024-03-21 17:19:34 -06:00
Diego Hurtado 1f3bcd6555
Remove [test] package from propagator-aws-xray (#2320)
Fixes #2230
2024-03-21 22:38:24 +00:00
Diego Hurtado bbcd5eebe3
Remove [test] package from opentelemetry-resource-detector-azure (#2317)
Fixes #2229
2024-03-21 16:10:16 -06:00
Diego Hurtado 4107d395cf
Remove [test] package from resource-detector-container (#2319)
Fixes #2228
2024-03-21 15:44:53 -06:00
Diego Hurtado a892b0b0f3
Remove [test] package from psycopg instrumentation (#2309)
Fixes #2308
2024-03-21 13:49:38 -06:00
Diego Hurtado 847e8faadc
Remove [test] package from sklearn instrumentation (#2303)
Fixes #2218
2024-03-21 13:06:16 -06:00
Diego Hurtado e7df01a26c
Remove [test] package from remoulade instrumentation (#2275)
Fixes #2216
2024-03-21 12:15:13 -06:00
Diego Hurtado 74f58219d0
Remove [test] package from redis instrumentation (#2274)
Fixes #2215
2024-03-21 11:58:12 -06:00
Samuel Colvin 5207a78460
avoid losing repeated HTTP headers (#2266)
* avoid loosing repeated HTTP headers

* fix fof wsgi, test in falcon

* add changelog

* add more tests

* linting

* fix falcon and flask

* remove unused test

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-03-21 11:30:54 -06:00
Diego Hurtado b84d779104
Remove [test] package from pymongo instrumentation (#2269)
Fixes #2212
2024-03-20 18:51:55 -06:00
Diego Hurtado ca8daea8bf
Remove [test] package from psycopg2 instrumentation (#2307)
Fixes #2210
2024-03-20 17:49:08 -06:00
Diego Hurtado fc864fe99a
Remove [test] package from mysql instrumentation (#2294)
Fixes #2207
2024-03-20 15:31:58 -06:00
Diego Hurtado 801dcedcb8
Remove [test] package from boto instrumentation (#2251)
Fixes #2191
2024-03-20 14:47:09 -06:00
Diego Hurtado ab97e07eef
Remove [test] package from kafka-python instrumentation (#2292)
Fixes #2205
2024-03-20 14:30:38 -06:00
Diego Hurtado 70d9b3d9ea
Remove [test] package from jinja2 instrumentation (#2291)
Fixes #2204
2024-03-20 12:02:34 -06:00
Diego Hurtado 51c78bf3a8
Remove [test] package from grpc instrumentation (#2290)
Fixes #2202
2024-03-20 11:40:37 -06:00
Diego Hurtado a8e57bfbb8
Remove [test] package from celery instrumentation (#2286)
Fixes #2195
2024-03-20 10:27:22 -06:00
Diego Hurtado ef7125000a
Remove [test] package from botocore instrumentation (#2284)
Fixes #2193
2024-03-20 10:10:15 -06:00
Diego Hurtado 5e1e866ec1
Remove [test] package from cassandra instrumentation (#2285)
Fixes #2194
2024-03-19 18:02:02 -06:00
Diego Hurtado 11812b190a
Remove [test] package from aws-lambda instrumentation (#2250)
Fixes #2190
2024-03-19 22:01:01 +00:00
Diego Hurtado 78424fa985
Skip celery test case if running in PyPy (#2349)
Fixes #2348

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-03-19 15:38:18 -06:00
Markus 1b68fdc8c8
Psycopg3 sync and async instrumentation (#2146) 2024-03-19 11:24:25 -07:00
Riccardo Magliocchetti c9832ba232
instrumentation/django: fix test_trace_parent (#2338) 2024-03-19 10:58:51 -07:00
Diego Hurtado dcffb584c4
Remove [test] package from asyncpg instrumentation (#2249)
Fixes #2189
2024-03-18 17:29:07 -06:00
Diego Hurtado 9bb73fc4c5
Remove [test] package from logging instrumentation (#2293)
Fixes #2206
2024-03-18 16:46:13 -06:00
Diego Hurtado 1782e96b77
Remove [test] package from dbapi instrumentation (#2288)
Fixes #2197
2024-03-18 19:42:10 +00:00
Diego Hurtado 6c2e54da64
Remove [test] package from sqlalchemy instrumentation (#2315)
Fixes #2219

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-03-18 18:44:02 +00:00
Rodrigo-Novas 617cae9375
Feature/convention http server duration (#2326)
* feat: add http.duration convention

* feat: add http.duration convention

* feat: replace for the last description version Duration of HTTP client requests

* feat: add new description to histogram
2024-03-18 17:29:10 +02:00
Diego Hurtado 223c79c617
Remove [test] package from mysqlclient instrumentation (#2295)
Fixes #2208
2024-03-15 23:37:18 -06:00
Diego Hurtado 8f02162221
Remove [test] package from elasticsearch configuration (#2312)
Fixes #3745
2024-03-15 15:26:38 -06:00
Diego Hurtado 0b5e3b4bcd
Remove [test] package from pymemcache instrumentation (#2310)
Fixes #2211
2024-03-15 15:08:03 -06:00
Diego Hurtado e30dd1abeb
Remove [test] package from urllib3 instrumentation (#2316)
Fixes #2226
2024-03-15 14:49:03 -06:00
Diego Hurtado 74820251f1
Remove [test] package from urllib instrumentation (#2282)
Fixes #2225
2024-03-15 14:33:49 -06:00
Diego Hurtado fbda226a5a
Remove [test] package from requests instrumentation (#2276)
Fixes #2217
2024-03-15 14:10:12 -06:00
Diego Hurtado d1c3cb33dc
Remove [test] package from httpx instrumentation (#2314)
Fixes #2203
2024-03-15 12:39:51 -06:00
Diego Hurtado 28f49a56e4
Remove [test] package from aiohttp-server instrumentation (#2242)
Fixes #2184
2024-03-15 17:37:21 +00:00
Diego Hurtado 17de1d5765
Remove [test] package from aiohttp-client instrumentation (#2238)
Fixes #2183
2024-03-15 11:16:35 -06:00
Diego Hurtado 8d43618798
Remove [test] package from tornado instrumentation (#2280)
Fixes #2223
2024-03-15 16:50:17 +00:00
Diego Hurtado 7404e69663
Remove [test] package from fastapi instrumentation (#2289)
Fixes #2201
2024-03-15 16:38:56 +00:00
Mario de Frutos Dieguez fd6b8f1647
Fix response hook (#2038)
Response hook receives a third parameter, Response, and that should be reflected in the _ResponseHook type

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-03-15 14:07:40 +02:00
Diego Hurtado e923938646
Remove [test] package from starlette instrumentation (#2278)
Fixes #2221
2024-03-15 01:53:17 +00:00
Diego Hurtado e56cdc8fec
Remove [test] package from pyramid instrumentation (#2273)
Fixes #2214
2024-03-14 19:29:18 -06:00
Diego Hurtado ba05c2c0c3
Remove [test] package from wsgi instrumentation (#2283)
Fixes #2227
2024-03-15 01:15:50 +00:00
Diego Hurtado ce2de1f5a9
Remove [test] package from falcon instrumentation (#2313)
Fixes #2200
2024-03-14 19:05:44 -06:00
Diego Hurtado 5f68e9701b
Remove [test] package for django instrumentation (#2311)
Fixes #2198
2024-03-15 00:54:12 +00:00
Diego Hurtado d948f21ad3
Remove [test] package from flask instrumentation (#2127)
Fixes #2126
2024-03-15 00:42:46 +00:00
Diego Hurtado 5552db2adf
Remove [test] package from asyncio instrumentation (#2248)
Fixes #2188
2024-03-14 18:32:23 -06:00
Diego Hurtado 1bf9f429e4
Remove [test] package from asgi instrumentation (#2247)
Fixes #2187
2024-03-14 18:18:52 -06:00
Diego Hurtado 2417c099a0
Remove [test] package from aio-pika instrumentation (#2244)
Fixes #2186
2024-03-15 00:07:12 +00:00
Diego Hurtado c54a9d1ad2
Remove [test] package from aiopg instrumentation (#2243)
Fixes #2185
2024-03-14 17:57:38 -06:00
Diego Hurtado 5b4e5d810a
Remove [test] package from opentelemetry-contrib-instrumentations (#2318)
Fixes #2236
2024-03-14 23:43:20 +00:00
Rodrigo-Novas 717d10760a
feat: add importlib metadata default on flask module (#2302)
* feat: add importlib metadata default

* feat: add importlib metadata default

* feat: add importlib metadata default

* Fix lint

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-03-14 15:56:32 -06:00
Riccardo Magliocchetti 3273d8c39f
Fix asyncio related warnings in tests (#2335)
* aiopg: fix runtime warnings when running tests

Fixes:
RuntimeWarning: coroutine 'MockCursor.execute' was never awaited
    cursor.execute(query)

* aio-pika: no need to return an awaitable in mocked method

No need to return an awaitable since the mocked method awaits
itself.
Fixes:
    RuntimeWarning: coroutine 'sleep' was never awaited

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-03-14 13:27:18 -06:00
John Bley 9b3d0b485e
Use set -e to catch errors in all scripts (#2347) 2024-03-14 17:29:38 +00:00
Rodrigo-Novas af1528d288
chore: fix md based on rules and fix bad links (#2240)
* chore: fix md based on rules and fix bad links

* chore: add index to contribuiting and readme files

---------

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-03-14 11:36:54 +02:00
Markus aa8ae2efe3
Celery duplicated instrumentation (#2342)
* * Adding (failing) testcase to cover Issue #2029

* * move Instance variables to class variables. Since the object in question will be a singelton. This will resolve #2029 where multiple calls to the instrumentation will assign Null values.

* * black formatting

* * Changelog stub entry, PR # to follow

* * updating the pullrequest number

* * remove superfluous constructor

* * moving Change log to unreleased section

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-03-14 10:50:04 +02:00
Diego Hurtado 1e0b11f07a
Fix docker test dependencies (#2345)
Fixes #2344
2024-03-13 16:33:47 -06:00
Andrew L cb5a07c765
Update README.rst (#2111)
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2024-03-13 14:05:31 +02:00
Emanuele Fumagalli 565e78de2c
Fix OpenTelemetry Aio-pika instrumentation link (#2259) 2024-03-07 11:56:04 -08:00
Filip Nikolovski 2e746198bf
Align gRPC server span status codes to OTEL specs (#2019) 2024-03-07 09:33:28 -08:00
Diego Hurtado 46a8c59e03
Refactor use of changedir in tox.ini (#2332)
Fixes #3745
2024-03-04 11:19:46 -06:00
Federico Bond 8daa8ad481
Add instrumentation for Psycopg 3.x (#2123)
* Add instrumentation for Psycopg 3.x

* Add federicobond to component_owners.yml
2024-02-24 19:35:25 +00:00
Leighton Chen 1c2171528e
Fix various release scripts aspects (#2267) 2024-02-23 10:50:39 -08:00
OpenTelemetry Bot adfb1c763d
Copy change log updates from release/v1.23.x-0.44bx (#2265) 2024-02-23 10:30:37 -08:00
OpenTelemetry Bot d2d4561593
Update version to 1.24.0.dev/0.45b0.dev (#2262) 2024-02-23 10:13:21 -08:00
Leighton Chen 343d137f95
Skipping certain folders in release script (#2258) 2024-02-22 16:12:38 -08:00
Diego Hurtado 565d2e33f4
Remove werkzeug from Flask instrumentation dependencies (#2257)
Fixes #2256
2024-02-22 17:34:53 -06:00
Tammy Baylis efb327d4d7
AwsLambdaInstrumentor handles and re-raises handler function exception (#2245) 2024-02-22 09:16:34 -08:00
Ben Beasley 2518a4ac07
Drop obsolete parameterized test dependency (#2134)
In the test dependencies for `opentelemetry-instrumentation-falcon`,
don’t depend on `parametrized` because `pytest.mark.parametrize` is now
included in `pytest`.
2024-02-14 22:21:14 -06:00
Allen Kim b6492a7999
Feature/asyncio instrumentation (#1943)
* add asyncio instrumentation

* add asyncio instrumentation

* modify test configure

* modify test configure

* modify tox generate result

* modify tox generate result

* add python version check

* modify test code

* add CHANGELOG.md

* add docs

* modify pyproject.toml

* modify pyproject.toml

* Add comments mentioned in an issue #1919

* Add comments mentioned in an issue #1919

* add asyncio component owner

* - Add instrumentation-asyncio metric.
- Configure coroutines/to_thread func to apply trace via environment variables.
- Apply trace to future using a boolean environment variable.

* modify docs

* modify docs

* modify docs

* modify docs

* modify docs

* modify test_code

* modify test_code

* modify test_code

* modify asyncio version

* modify asyncio version

* update dependency

* modified lint results

* modified lint results

* modified lint results

* modified lint results

* modified lint results

* modified lint results

* modified lint results

* include feedback

* include feedback

* include feedback

* modify docs test results

* Update instrumentation/opentelemetry-instrumentation-asyncio/README.rst

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

* Update instrumentation/opentelemetry-instrumentation-asyncio/README.rst

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

* Update instrumentation/opentelemetry-instrumentation-asyncio/README.rst

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

* Update instrumentation/opentelemetry-instrumentation-asyncio/README.rst

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

* Update instrumentation/opentelemetry-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/utils.py

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

* Update instrumentation/opentelemetry-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/utils.py

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

* include feedback

* include feedback

* drop python 3.7 support

* drop python 3.7 support

* Removed from default_instrumentations

* Recover

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2024-02-14 15:44:17 -06:00
Leighton Chen 02e38edc54
Fix azure vm resource detector tests/Suppress instrumentation for urllib call (#2178) 2024-02-14 12:51:27 -08:00
Iuri de Silvio 1a984d3ba1
Upgrade tox (#2118)
* Upgrade tox

* fixup! Upgrade tox

* Add excludes

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-02-13 22:33:14 -06:00
Diego Hurtado 03fcc1742d
Remove references to 3.7 (#2172)
Fixes #2171
2024-02-13 12:55:45 -06:00
Diego Hurtado d167ef7b43
Fix celery and urllib tests (#2170)
* Update core SHA

Fixes #2173

* Fix celery and urllib tests

Fixes #2164
2024-02-12 17:54:32 -06:00
Diego Hurtado 8fd2105cea
Update core SHA (#2163)
Fxes #2162
2024-02-10 07:02:35 -06:00
Marcus Lim 47caeab7af
Stop multiple calls to AsyncPGInstrumentor.__init__ from clobbering instance attributes (#1791)
* Stop multiple calls to AsyncPGInstrumentor.__init__ from clobbering instance tracer attribute

* Remove class-level initialisation of _tracer

* Fix regex

* Add to changelog

* Fix lint errors

* Update CHANGELOG.md

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>

* Set tracer in class definition to avoid lint error

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-02-05 13:55:24 +02:00
Bruno Guimarães 13ce910f14
Fix link to OpenTelemetry kafka-python Instrumentation (#2147)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2024-02-04 09:26:49 +00:00
Diego Hurtado 6c13a5eddc
Drop support for 3.7 (#2152)
* Drop support for 3.7

Fixes #2151

* Remove 37
2024-02-03 11:57:08 -06:00
Sofiia Tesliuk c68d0fd192
Add support for confluent_kafka until 2.3.0 version; (#2132)
* Updated version of supported confluent kafka to 2.3;

* Updated CHANGELOG.md;

---------
2024-01-30 22:48:45 -06:00
Ben Beasley 3400ecea5d
Remove useless shebangs (#2135)
These files do not have the executable bit set in their filesystem
permissions (so the shebang line, `#!`, is useless), and they are not
script-like (do not have `if __name__ == "__main__"` or interesting
side-effects), so making them executable would not make sense.
2024-01-30 22:24:33 -06:00
Steve Flanders e88bf5f27a
Update opentelemetry-instrument README (#2108)
* Update opentelemetry-instrument README

- Clarify trace versus metric documentation
- Add console exporter documentation
- Add quotes to command to support zsh
- Fix grammatical errors

* fix typo

* fix typo

* Remove note on HTTP for trace only

---------
2024-01-31 04:01:46 +00:00
Adrian Garcia Badaracco 4b1a9c75db
feat: configure header extraction for ASGI middleware via constructor params (#2026)
* feat: configure header extraction for ASGI middleware via constructor params

* fix django middleware

* lint

* remove import

* Fix lint

* Update instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
2024-01-30 21:11:00 -06:00
Jeremy Voss a93bd74dc3
Increment resource detector version (#2137) 2024-01-25 10:05:40 -08:00
Jeremy Voss 743c2fe2d8
Update azure resource detector timeout to 4 seconds (#2136) 2024-01-24 10:10:51 -08:00
Diego Hurtado f2c536ed82
Fix tox factor matching (#2129)
* Fix tox factor matching

Fixes #2128

* Add missing fixes for several test envs

* Fix django
2024-01-17 17:14:43 -06:00
Allen Kim c9d709a5c4
Feature/support for flask 3.0.0 (#2013)
* support flask 3.0.0

* support flask 3.0.0

* support flask 3.0.0

* modify tox.ini

* modify Werkzeug version

* modify Werkzeug version

* modify flask test version

* modify flask version

* modify flask version

* modify CHANGELOG.md

* include feedback

* include feedback

* Fix lint and generate

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2024-01-16 15:45:12 -06:00
Diego Hurtado 42faa1a34a
Separate jobs per instrumentation (#2121)
* Separate jobs per instrumentation

Fixes #2036

* Separate in 2 workflows

* Added explanation for separation
2024-01-11 13:03:28 -06:00
Leighton Chen c2691e049b
Update version.py for release (#2120) 2024-01-10 12:41:44 -08:00
Jeremy Voss 588d5d7003
Add 10 second timeout to VM Resource Detector (#2119) 2024-01-09 15:02:09 -08:00
Kenny Guo 14d7779366
Update README.rst (#2060) 2024-01-05 20:05:58 +00:00
Jeremy Voss 7c12ad9844
Fix dependency for azure resource detector (#2072) 2023-12-22 23:40:32 +00:00
Adrian Garcia Badaracco 9563ee73ac
Clean up use of suppress_instrumentation in context and fix httpx bug (#2061)
* Clean up use of suppress_instrumentation in context and fix httpx bug

* Clean up use of suppress_instrumentation in context and fix httpx bug

* changelog

* fix tests

* fix import

* fmt

* update dep

* lint

* remove unused imports

* apply lint

* Fix version for pika

* Fix lint

---------
2023-12-22 22:43:12 +00:00
Denis Otkidach e5aa74ff7f
Remove URL credentials (httpx integration) (#2020)
* Remove URL credentials (httpx)

* Add CHANGELOG
2023-12-22 22:03:51 +00:00
Jean Jordaan d7cc194609
`FlaskInstrumentation` doesn't exist (#2070)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-12-22 21:23:38 +00:00
OpenTelemetry Bot 772063ca8a
Update version to 1.23.0.dev/0.44b0.dev (#2091)
* Update version to 1.23.0.dev/0.44b0.dev

* Update core SHA

* Update generate

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-12-15 16:54:11 -06:00
Diego Hurtado b6c11054b9
Fix Falcon dependency (#2090)
Fixes #2089
2023-12-13 20:58:54 -06:00
Leighton Chen 4bf3577fb7
Requests instrumentation http semantic convention migration (#2002) 2023-11-29 14:22:16 -08:00
Sean Kenny 4336dc7330
Fix arity of context.abort for AIO RPCs (#2066) 2023-11-28 10:38:59 -08:00
Bulygin Evgeny b29682b561
aio-pika instrumentation: Removed check for non-sampled span when inject message header. (#1969)
* aio-pika instrumentation: Removed check for non-sampled span when inject message headers. Reason to change is that sampled flag can be propagate https://www.w3.org/TR/trace-context/#sampled-flag and be useful when trace is not sampled.

* black formting

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-11-27 14:22:34 +00:00
samypr100 1b1c38d7cd
[opentelemetry-instrumentation-httpx] fix mixing of sync and non async hooks (#1920)
* fix: sync response hooks being used on httpx.AsyncClient

* docs: add changelog

* docs: improved docs a bit more

* docs: fix variable name

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-11-21 15:45:15 +02:00
Srikanth Chekuri 773e431bf5
Add a note about system dependencies for instrumentation pkgs (#2068)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-11-21 09:01:04 +00:00
Srikanth Chekuri 5888d4ef95
Enable lint on CI and update deps (#2067)
* Fix black an isort

* change bootstrap_gen to use a list instead of dict

* Bunch of updates

* Fix build

* fix lint

* Fix docs

* Fix lint

* More fixes

* Fix lint

* fix stupid mistake

---------

Co-authored-by: Christian Hartung <christian.hartung@olist.com>
2023-11-21 10:25:11 +02:00
Pierre Tessier 9afaf26b3a
urllib/urllib3 - set metric descriptions per semantic conventions (#1959)
* Set metric descriptions per semantic conventions

* Set metric descriptions per semantic conventions

* fix spelling

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-11-19 08:20:41 +02:00
Adrian Garcia Badaracco f34771618c
Don't collect system.network.connections due to limitation in psutil causing exceptions (#2008)
* Don't collect system.network.connections due to limitation in psutil causing exceptions

* add changelog

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-11-17 08:54:56 +00:00
Rahul Kumar 6f6c28da45
Added support for pypy3 system metrics (#2062)
* Added support for pypy3 system metrics

Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>
Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>

* Change in if condition to log warn message for pypy
Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>

Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>

* Added logger to else block if pypy
Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>

Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>

* Reverting the changes
Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>

Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>

* Changes requested by external reviewer
Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>

Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>

---------

Signed-off-by: Rahul Kumar <Rahul.Kumar@fmr.com>
Co-authored-by: Suryanarayana Peri <suryanarayana.peri@fmr.com>
2023-11-16 13:18:51 -06:00
Leighton Chen b6d77f1146
Implement Otel semantic convention stability opt-in (#1987) 2023-11-10 09:48:32 -08:00
OpenTelemetry Bot 7166de673f
Copy change log updates from release/v1.21.x-0.42bx (#2049) 2023-11-09 16:05:21 -08:00
Leighton Chen 1e1162c250
Fix error in build for README in Cassandra instrumentation (#2045) 2023-11-09 22:42:26 +00:00
Leighton Chen c2f3894002
Fix contrib build (#2054) 2023-11-09 14:07:24 -08:00
siminn-arnorgj 46fc3ce638
Exclude background task execution from root server span in ASGI middleware (#1952) 2023-11-08 18:46:01 +00:00
OpenTelemetry Bot 3b9d6264e2
Update version to 1.22.0.dev/0.43b0.dev (#2031)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-11-07 11:06:08 -06:00
Liudmila Molkova 4f6618324d
Set schema_url on all tracers and meters (#1977) 2023-11-06 11:39:51 -08:00
Diego Hurtado eb6024ca31
Fix failing test cases (#2033) 2023-11-03 05:40:46 +00:00
Diego Hurtado 98923dc5b3
Add -ra option to pytest runs (#2035) 2023-11-02 20:50:41 -06:00
Margaret Yu 657d502419
Specify the topic arn as the span attribute messaging.destination.name in the botocore sns instrumentation (#1995) 2023-11-01 15:54:26 -06:00
André "decko" de Brito 1305436671
Aiohttp-server Instrumentation (#1800)
Co-authored-by: Kenny Trytek <kenny.trytek@workiva.com>
Co-authored-by: Daniel Manchon <dmanchon@gmail.com>
2023-10-30 15:10:16 -06:00
Jeremy Voss 3478831838
Using new cloud resource id attribute (#1976) 2023-10-09 19:02:52 +00:00
Allen Kim bb42e0417b
Feature/add new process metrics (#1948) 2023-10-09 10:34:02 -07:00
Diego Hurtado 7ac674430d
Fix version of Flask dependency werkzeug (#1980) 2023-10-04 20:20:39 +00:00
Leighton Chen e318c947a2
Update pyproject.toml (#1950) 2023-09-12 14:47:30 -07:00
Leighton Chen 4abb0e3216
Modify eachdist and build script for container packages (#1949) 2023-09-12 13:33:39 -07:00
OpenTelemetry Bot 54be1603dc
Update version to 1.21.0.dev/0.42b0.dev (#1930)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-09-04 17:56:57 +00:00
João Thallis fb9eb32fac
doc: fix `commenter_options` type (#1926)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-09-03 11:23:21 +00:00
Noemi 6f3aead436
Unwrap Celery's `ExceptionInfo` (#1863)
* Unwrap `ExceptionInfo` and `ExceptionWithTraceback`

Instead of reporting the `ExceptionInfo` and `ExceptionWithTraceback`
wrappers raised by Celery, report the exceptions that they wrap.

This ensures that the exception in the OpenTelemetry span has a type
and traceback that are meaningful and relevant to the developer.

* Fix typo

The exception is expected, not excepted. Well, I guess it is also
excepted, because it's an exception, but you get what I mean.

* Reformat file with `black`

Reformat the `__init__.py` file in the Celery instrumentation using
`black`, fixing a CI linter error.

* Address review feedback

Use the VERSION attribute exposed by Billiard to decide whether to
import ExceptionWithTraceback.

Add a test for a failing task and check that the exceptions' type
and message are preserved.

* Amend ExceptionWithTraceback import
2023-09-03 13:56:33 +03:00
mattcontinisio a02d98cb38
Add Cassandra instrumentation (#1902) 2023-08-30 15:40:14 +00:00
Javier Fernández Rodríguez d854c52d23
feat(confluent-kafka): Add instrumentation to consume method (#1786)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-08-30 15:03:05 +00:00
Raphael Philipe Mendes da Silva 0871dd455c
Revert "update awslambda to use _X_AMZN_TRACE_ID as a Span Link" (#1911)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-08-21 18:42:12 +02:00
Jeremy Voss 9627f74a73
Azure resource detectors (#1901) 2023-08-17 13:21:59 -07:00
Leighton Chen 9cd9de7f01
Fix errors introduced in regression (#1913) 2023-08-16 13:25:50 -07:00
Jakub Warczarek 6007e0c013
Merge pull request from GHSA-5rv5-6h4r-h22v
* Fix unbound cardinality for label http_method in wsgi based middlewares

* cr: rename file

* cr: change label UNKNOWN to NONSTANDARD

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

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-08-15 13:17:14 -07:00
Thomas LÉVEIL 1beab8238b
Fix UnboundLocalError local variable 'start' referenced before assignment (#1889)
Co-authored-by: Pablo Collins <pablo.collins@gmail.com>
2023-08-07 15:17:20 +02:00
Tristan Sloughter 7603a1fc69
update awslambda to use _X_AMZN_TRACE_ID as a Span Link (#1657)
Co-authored-by: Ron Yishai <ronyish@cisco.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-07-18 22:03:59 +02:00
Diego Hurtado 74fcbf4a6e
Fix pyyaml version (#1892) 2023-07-18 18:49:51 +00:00
OpenTelemetry Bot cfdd4ae77f
Update version to 1.20.0.dev/0.41b0.dev (#1885)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-07-13 16:42:32 +02:00
Alexandre Papin 09efe708c3
Instrument mysqlclient library (#1744)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-07-12 21:09:26 +02:00
Marc Dougherty acfe932f7d
fix(django): avoid empty span name on empty path (#1788)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-07-12 18:38:59 +00:00
Jeremy Voss db90ce38a2
Distro selection (#1823) 2023-07-11 20:26:14 +00:00
Mario Jonke dadcd01524
urllib3: Add instrumentation support for version 2 (#1879)
* urllib3: Add instrumentation support for version 2

* changelog
2023-07-04 00:49:20 +03:00
Diego Hurtado a1f6044672
Add statement of maintainership (#1859)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-28 12:29:01 +02:00
Tammy Baylis 79d62b3bcd
sqlalchemy wrap_create_engine now accepts sqlcommenter options (#1873)
* sqlalchemy wrap_create_engine accepts sqlcommenter options

* Changelog

* Lint

* Fix default val

* Add sqlalchemy tests

* Change a default in _instrument get

* Lint

* More lint

* Update default

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>

* Update args doc

* lintttt

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-27 13:43:35 +03:00
Rytis Bagdziunas 2e49ba1af8
Use a weak reference to sqlalchemy Engine to avoid memory leak (#1771)
* Use a weak reference to sqlalchemy Engine to avoid memory leak

Closes #1761

By using a weak reference to the `Engine` object, we can avoid the memory leak as disposed `Engines` get properly deallocated. Whenever `SQLAlchemy` is uninstrumented, we only trigger a removal for those event listeners which are listening for objects that haven't been garbage-collected yet.

* Made a mistake in resolving the weak reference

* Fixed formatting issues

* Updated changelog

* Added unit test to check that engine was garbage collected

* Do not save engine in EngineTracer to avoid memory leak

* Add an empty line to satisfy black formatter

* Fix isort complaints

* Fixed the issue when pool name is not set and =None

* Fix formatting issue

* Rebased after changes in a recent commit

* Updated PR number in changelog

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-27 11:37:27 +03:00
Shalev Roda a45c9c3792
Update maintainers list (#1874) 2023-06-26 08:41:27 +02:00
Vivanov98 cd6b024327
Fix async redis clients tracing (#1830)
* Fix async redis clients tracing

* Update changelog

* Add functional integration tests and fix linting issues

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-25 15:03:54 +03:00
Tammy Baylis e70437a36e
Add conditional elastic_transport import (#1810)
* Add conditional elastic_transport import

* Update changelog

* Add future es8 tests

* Update CHANGELOG.md

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>

* Add license, rm pylint disable

* Consistent elastic version check

* lint import

* Update CHANGELOG.md

---------

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-25 08:25:09 +03:00
Nimrod Shlagman c9004bd375
Fix elastic-search sanitization for bulk queries (#1870)
* support sanitization for str body response

* add CHANGELOG entry

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-25 07:44:57 +03:00
Iman Shafiei 256d8ce12d
Add http.server.request.size for ASGI metric implementation (#1867)
* Update changelog file.

* Update changelog file.

* Add new request.size metric for ASGI middleware.

* Clean-up.

* Refactor try except section.

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-21 23:56:38 +03:00
Matt Oberle 32ae65ed55
fix(grpc): Allow gRPC connections via Unix socket (#1833)
* fix(grpc): Allow gRPC connections via Unix socket

This commit addresses issue #1832.

The way `NET_PEER_IP` and `NET_PEER_PORT` are retrieved raises a `ValueError`
when gRPC connections are handled via Unix sockets.

```py
ip, port = (
    context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1)
)
```

When using an address like `unix:///tmp/grpc.sock` the value of `context.peer()` is `"unix:"`.
Substituting that in the function above...

```py
ip, port = "unix:".split(",")[0].split(":", 1)[1].rsplit(":", 1)
ip, port = ["unix:"][0].split(":", 1)[1].rsplit(":", 1)
ip, port = "unix:".split(":", 1)[1].rsplit(":", 1)
ip, port = ["unix", ""][1].rsplit(":", 1)
ip, port = "".rsplit(":", 1)
ip, port = [""]  # ValueError
```

I "addressed" the issue by guarding the retrieval of `net.peer.*` values under
an `if` statement that checks if we are using a Unix socket.

I extended the `server_interceptor` tests to run against TCP and Unix socket configurations.

---

**Open Questions**

- [ ] The socket tests will fail on Windows. Is there a way to annotate that?
- [ ] Are there other span values we should be setting for the unix socket?

* Update CHANGELOG

* Add placeholder attributes for linter

* fix lint

---------

Co-authored-by: Matt Oberle <mattoberle@users.noreply.github.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-21 15:30:35 +03:00
dependabot[bot] ffc9334dd7
Bump requests from 2.28.1 to 2.31.0 (#1818)
Bumps [requests](https://github.com/psf/requests) from 2.28.1 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.28.1...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  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: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-20 16:01:36 +00:00
Michael fe9405730f
fix: Update falcon instrumentation to follow semantic conventions (#1824)
* fix: Update falcon instrumentation to follow semantic conventions

* docs: Update changelog

* fix linter errors

* Disable falcon.HTTP_200 pylint checck

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-06-20 11:09:53 +00:00
Iman Shafiei 60753e2a55
Add http.server.response.size metric to ASGI implementation. (#1789)
* Add http.server.response.size metric to ASGI implementation.
Add new unit tests.

* Update changelog.

* Fix linting by disabling too-many-nested-blocks

* Put new logic in a new method

* Refactor the placement of new logic.

* Fixed the unit tests in FastAPI and Starlette

* Update changelog.

* FIx lint errors.

* Refactor getting content-length header

* Refactor getting content-length header

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-06-19 23:00:59 +03:00
Pablo Collins 8cc10a0859
fix redis doc (#1808)
doc string rendered at
https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/redis/redis.html
refers to `opentelemetry-instrumentation` executable which appears to be a typo

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-18 16:55:17 +03:00
David Gonoradsky 5ac58c2ffb
Add support for confluent_kafka until 2.1.1 version (#1815)
* Add support for confulent_kafka until 2.1.1 version

* Include 2.1.1 version

* update CHANGELOG.md

* run: 'tox -e generate'

* resolve comments

* update top version to 2.2.0

---------

Co-authored-by: Ran Nozik <ran@gethelios.dev>
2023-06-18 13:20:21 +00:00
Akochavi 1dd17edeea
Add metrics instrumentation celery (#1679)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-18 10:45:00 +00:00
Iman Shafiei 78040836d2
Fix Invalid type NoneType for attribute X error | AWS-Lambda instrumentation (#1785)
* Add None checking to the aws-lambda logic

* Update changelog.

* Change .get() check to 'key' in dict check.

* Fix consistency issues.

* Update changelog.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-17 02:55:15 +03:00
Yashaswi Makula a3a0b2409c
Fixed urllib3 instrumentation example in instrumentation documentation (#1793)
* corrected instrumentation example in urllib3

* Remove changelog entry

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-06-16 23:08:51 +00:00
Tammy Baylis 7292beefae
Request Flask attributes passed to Sampler (#1784)
* Request Flask attributes passed to Sampler

* Update changelog

* Lint

* Fix botocore test keyerror

* Revert "Fix botocore test keyerror"

This reverts commit fd03c55a39.

* botocore test does get_queue_url

* Revert "botocore test does get_queue_url"

This reverts commit 9530cd250d.

* Update changelog

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-16 22:40:46 +00:00
Filip Nikolovski f9f7b01416
Fix falcon usage of Span Status (#1840)
* Fix falcon usage of Span Status to only set the description if the status code is ERROR

* Update changelog

* Update CHANGELOG.md

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

* fix lint

* Use fewer variables to satisfy R0914 lint rule

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-06-16 16:18:08 +00:00
Maciej Nachtygal 743ac64661
Issue #1757 - Update HTTP server/client instrumentation span names (#1759)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-06-16 00:21:05 +02:00
Phillip Verheyden a5ed4da478
Relax httpx version to allow >= 0.18.0 (#1748) 2023-06-13 13:07:28 +00:00
Nimrod Shlagman 37d85f0745
Sanitize redis db_statement by default (#1776)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-13 12:37:55 +00:00
Srikanth Chekuri 818ef43223
remove srikanthccv from maintainers (#1792)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-06-13 11:54:41 +00:00
Matthew Grossman 4637912418
Use `request_ctx` to determine whether or not `_teardown_request` should end flask span (#1692)
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-06-13 13:23:48 +02:00
Diego Hurtado fc547877d3
Remove use of httpbin (#1854) 2023-06-13 10:30:52 +00:00
Diego Hurtado bcf770d079
Use HTTP mock server for tornado tests (#1855)
* Use HTTP mock server for tornado tests

Fixes #1681

* Fix lint
2023-06-13 10:01:02 +00:00
Diego Hurtado 26c673e7c9
Use HTTP mock server for aiohttp tests (#1849)
Fixes #1842
2023-06-13 08:40:41 +00:00
Shalev Roda 776f9d4643
Fix celery docker tests (#1841) 2023-06-13 10:07:45 +02:00
Shalev Roda 2edcc21ea2
skip urllib3 test on pypy3 (#1826) 2023-06-09 15:18:16 +02:00
Diego Hurtado a679754172
Update maintainers list (#1817) 2023-05-23 17:14:38 -06:00
Diego Hurtado cae6ce46ec
Refactor CODEOWNERS file (#1804)
* Refactor CODEOWNERS file

Fixes #1803

* Remove CODEOWNERS

* Refactor component owners configuration

* Refactor CODEOWNERS to select any file but the ones in instrumentation

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-05-22 17:19:50 -06:00
Tristan Sloughter 42e8f8f6e2
botocore: always use x-ray for http header injection (#1741)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-05-22 18:02:05 +00:00
Sanket Mehta 530650df41
Resource detector for container properties (#1584)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-05-22 11:24:31 -06:00
OpenTelemetry Bot afd8428997
Update version to 1.19.0.dev/0.40b0.dev (#1797)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-05-17 10:47:58 -06:00
Shalev Roda db46e8eaab
Skip requests tests for pypy3 (#1806) 2023-05-16 23:38:15 +05:30
Shalev Roda 1a1163e919
Expand sqlalchemy pool.name to follow the semantic conventions (#1778) 2023-05-06 23:09:52 +05:30
Nahian-Al Hasan 890e5dd9b8
Add otelTraceSampled to instrumetation-logging (#1773)
* Add otelTraceSampled to instrumetation-logging

* Updated code with black

* Added to CHANGELOG.md

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-05-03 22:06:25 +05:30
Naor Malca 46e4b1da44
Add support for anonymous tasks (#1407) 2023-04-28 23:09:24 +00:00
Tammy Baylis f46a6e1c0e
Request ASGI attributes passed to Sampler (#1762)
* Request ASGI attributes passed to Sampler

* Update changelog

* aiohttp-client test http.url

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-04-28 16:47:51 +00:00
RJ Duffner c8b06539c0
Add support for pymemcache version > 4.0.0 (#1764) 2023-04-28 21:10:10 +05:30
Diego Hurtado 5117098024
Fix expected URL in aiohttp instrumentation test (#1772)
* WIP

* Revert "WIP"

This reverts commit 3ed466348e4c172fd96569a0dcb1b15047760cef.

* Fix expected URL in aiohttp instrumentation test

The underlying cause of the issue here is the update of the yarl package
from 1.8.2 to 1.9.1. yarl is used as a dependency in the
opentelemetry-instrumentation-aiohttp package but it is not there where
the issue happens, but in aiohttp who also has yarl as a dependency.

This is why the fix does not touch any relevant part of any
opentelemetry-* code, since it is the return value of aiohttp code who
now has a different value for the URL.

Fixes #1770
2023-04-25 11:44:11 -06:00
Nimrod Shlagman 19fe7713e2
Sanitize DB_STATEMENT by default for elasticsearch (#1758) 2023-04-23 22:55:05 +05:30
mshebeko-twist 2d4e6c9ac7
fix: None does not implement middleware when there are no middlewares (#1766) 2023-04-19 22:53:21 +05:30
Yaron d01c96fb42
added request and response hooks for grpc client (#1706) 2023-04-15 16:48:57 +05:30
Evan Pavlica a7a4f71570
Prevent AttributeError from being raised when lambda event is a list (#1738) 2023-04-05 00:23:21 +05:30
Stanley Liu e4d42e6632
Update runtime metrics to follow semantic conventions (#1735) 2023-04-04 01:54:35 +05:30
Srikanth Chekuri 20d2cc311a
Fix CHANGELOG (#1739) 2023-04-01 00:54:45 +05:30
Rafael Muñoz 27d6706f90
Pass request attributes to Sampler in Django (#1730) 2023-03-31 19:34:57 +05:30
Leighton Chen 4e059b15d2
Add exclude_list for urllib/urllib3 instrumentations (#1733)
* urllib

* urllib3

* Update __init__.py

* readme

* lint
2023-03-30 19:10:23 -06:00
Srikanth Chekuri 5052190c13
skip instrumentation-boto* pypy env tests (#1737) 2023-03-30 17:52:07 -06:00
OpenTelemetry Bot e4d8f10ecd
Update version to 1.18.0.dev/0.39b0.dev (#1723) 2023-03-22 22:01:45 +05:30
Srikanth Chekuri 1f67dcfeec
Remove pinned version importlib-metadata (#1725) 2023-03-22 03:06:19 +05:30
Federico Bond 2629c12161
Implement request and response hooks in requests library instrumentation (#1717) 2023-03-16 21:24:10 +00:00
Rafael Muñoz fbec281553
Fix typo (#1721) 2023-03-16 11:38:13 +00:00
Rajashree Mandaogane 88783f9632
Allow Kafka producer headers to be dict or list (#1655)
* Allow Kafka producer headers to be dict or list

* modify kafka context getter helper methods to work on dict and list

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-03-10 12:59:05 +00:00
sam-mosleh 419975138b
Fix httpx resource warnings (#1695) 2023-03-08 11:54:32 +00:00
Akochavi e5d9ac5755
fix fastapi instrumentation tests for version 0.91 (#1710) 2023-03-07 20:29:24 +05:30
Leighton Chen 135280e539
Change instruments version for fastapi and starlette (#1708) 2023-03-06 10:34:22 -08:00
Rytis Bagdziunas 4a859e34d6
Remove custom arguments in object.__new__ of BaseInstrumentor (#1439)
* Add a test case to reproduce the issue

* Fix the class initialization when parameters are provided

* Update CHANGELOG.md

* Fix linting issues

* Additional test case which inits SystemMetricsInstrumentor twice

* Updated linting following update to black style

* Moved changelog entry to unreleased section

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2023-02-28 11:19:30 -06:00
Leighton Chen b701980ab8
rel (#1700) 2023-02-27 12:34:14 -08:00
Shalev Roda c5a2db5cfb
Add entry for sqlalchemy component owner (#1696) 2023-02-27 23:52:16 +05:30
Lucas Rangel Cezimbra d6a024302e
Fix AWS Lambda documentation (#1693)
Fix `ImportError: cannot import name 'AwsBotocoreInstrumentor' from 'opentelemetry.instrumentation.botocore'`

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-27 14:11:32 +00:00
Shalev Roda 7ffbfc302e
Add metrics instrumentation sqlalchemy (#1645) 2023-02-26 20:21:42 +05:30
danielwiltshire 0417141a70
Add support for enabling Redis sanitization from environment variable (#1690)
* Add support for enabling Redis sanitization from environment variable

* add sanitization environment variable docs

* strip environment variable

* update changelog

* lint

* lint

* lint - hopefully the last time

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-25 01:27:31 +00:00
Israël Hallé 85ae95c88f
Fix exception in Urllib3 when dealing with filelike body. (#1399) 2023-02-25 00:41:06 +00:00
Shalev Roda a7bd56354b
Change metrics test to work with base_test.py (#1688) 2023-02-25 03:35:45 +05:30
Sri Aradhyula a50caf26bc
Fix exporter example docker-compose path (#1691) 2023-02-24 03:35:57 +00:00
hangonlyra 74a8b902f1
Fix issue with Flask instrumentation when a request spawn children threads and copies the request context (#1654) 2023-02-22 21:37:59 +00:00
Bas Schoenmaeckers 3bcc043e9d
Add connection attributes to sqlalchemy connect span (#1608)
* Add connection attributes to sqlalchemy connect span

* Fix formatting

* Move changelog entry to unreleased section

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-02-20 17:17:18 +00:00
Nimrod Shlagman d5cbd67e88
Add boto3sqs to docs (#1666) 2023-02-20 21:51:13 +05:30
Akochavi aa6397ad59
Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracer… (#1616)
* Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracerProvider

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-18 02:07:07 +00:00
OpenTelemetry Bot 52d01f9e6f
Copy change log updates from release/v1.16.x-0.37bx (#1683) 2023-02-18 06:40:50 +05:30
OpenTelemetry Bot 482804451a
Update version to 1.17.0.dev/0.38b0.dev (#1677)
* Update version to 1.17.0.dev/0.38b0.dev

* Update SHA

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-17 11:42:54 -06:00
Srikanth Chekuri 79d00ee7d3
Fix CI Failure (#1680)
* Fix CI Failure

* Actually fix

* Should be fixed now?

* Update tox.ini

* Disable test

* pypy3.7
2023-02-17 10:32:10 -06:00
Phillip Verheyden ffbbb4d8e3
Add better debugging if hatch subprocess fails (#1672) 2023-02-15 21:46:56 +05:30
Nimrod Shlagman 1e89854832
Add confluent kafka docs (#1668)
* add elasticsearch to docs

* add confluent kafka to docs

* tox generate fix

* tox docs fix

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-15 12:17:28 +00:00
Phillip Verheyden 5e4766ed66
Support aio_pika 9 (#1670) 2023-02-15 17:11:07 +05:30
Akochavi b513d1f910
Audit and test opentelemetry-instrumentation-wsgi NoOpTracerProvider (#1610) 2023-02-13 22:55:13 +00:00
Leighton Chen 1c50e47b56
bot (#1667) 2023-02-13 15:46:40 -06:00
Rajashree Mandaogane 3f8fdf2620
Add commit method for ConfluentKafkaInstrumentor's ProxiedConsumer (#1656) 2023-02-13 19:02:27 +00:00
Diego Hurtado b8d7448f34
Revert #1097 (#1660)
Several issues have arisen from this bugfix, reverting here until a
better solution can be found.

Fixes #1658

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-13 10:46:29 -06:00
Akochavi 7aa4aec3a6
Audit and test opentelemetry-instrumentation-django NoOpTracerProvider (#1611) 2023-02-13 15:01:48 +00:00
Akochavi 0a4b3b4a0c
Audit and test opentelemetry-instrumentation-aiohttp-client NoOpTrace… (#1612) 2023-02-13 11:00:24 +00:00
Akochavi 260df4dc6d
Audit and test opentelemetry-instrumentation-flask NoOpTracerProvider (#1614) 2023-02-13 09:49:17 +00:00
Akochavi e608df9357
Audit and test opentelemetry-instrumentation-dbapi NoOpTracerProvider (#1607) 2023-02-13 07:26:57 +00:00
Diego Hurtado bb41b4600a
Fix fastapi version (#1664) 2023-02-13 12:17:38 +05:30
avzis 3bcc9fb517
add a test for pymemcache using NoOpTracerProvider (#1650)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-11 15:11:22 +05:30
Nimrod Shlagman df32e8ca7f
add elasticsearch db.statement sanitization (#1598) 2023-02-10 06:20:42 +05:30
dbf 7af87e1bec
[TortoiseORM instrumentation] Fix `AttributeError: type object 'Config' has no attribute 'title'` (#1575)
* Use pydantic model name as default `title` value

* Update `CHANGELOG.md`

* Format with black

* Lint with `black`
2023-02-06 12:20:20 +00:00
Phillip Verheyden 66ceef5fe1
Support aio_pika 8.x (#1481)
* Support aio_pika 8

- Fix tests for new shape of the AbstractConnection class
- Run tests against aio_pika 7 and 8

* Update CHANGELOG.md

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-05 11:54:21 +05:30
Akochavi 2519223a5c
Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider (#1606)
* Audit and test opentelemetry-instrumentation-aiopg NoOpTracerProvider

* Change line length

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 20:55:41 +00:00
avzis a217682a39
Add a test for aws lambda using NoOpTracerProvider (#1602)
* add a test for aws lambda using NoOpTracerProvider

* fix import

* add assert for spans

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 19:41:30 +00:00
Tom de Bruijn 2b6f913790
Add Redis instrumentation query sanitization (#1572)
* Add Redis instrumentation query sanitization

Add a query sanitizer to the Redis instrumentation. This can be disabled
with the `sanitize_query = False` config option.

Given the query `SET key value`, the sanitized query becomes `SET ? ?`.
Both the keys and values are sanitized, as both can contain PII data.

The Redis queries are sanitized by default. This changes the default
behavior of this instrumentation. Previously it reported unsanitized
Redis queries.

This was previously discussed in the previous implementation of this PR
in PR #1571

Closes #1548

* Update Redis sanitize_query option documentation

Changes suggested in
https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572#discussion_r1066069584

* Remove uninstrument & instrument from test setup

The Redis test that performs the tests with the default options, doesn't
need to uninstrument and then instrument the instrumentor. This commit
removes the unnecessary setup code. The setup code is already present at
the top of the file.

* Fix code style formatting

* Update Redis functional tests

- Update the sanitizer to also account for a max `db.statement`
  attribute value length. No longer than 1000 characters.
- Update the functional tests to assume the queries are sanitized by
  default.
- Add new tests that test the behavior with sanitization turned off.
  Only for the tests in the first test class. I don't think it's needed
  to duplicate this test for the clustered and async setup combinations.

* Test Redis unsanitized queries by default

Change the Redis functional tests so that they test the unsanitized
query by default, and test the sanitized query results in the separate
test functions.

This is a partial revert of the previous commit
8d56c2f72e

* Fix formatting issue in Redis utils

* Disable Redis query sanitization by default

Update the Redis instrumentation library to not change the default
behavior for the Redis instrumentation. This can be enabled at a later
time when the spec discussion about this topic has concluded.

https://github.com/open-telemetry/opentelemetry-specification/issues/3104

* Fix pylint issue

Remove else statement.

* Update changelog about Redis query sanitization default

[ci skip]

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

* Fix potential error on Redis args being 0

Check the length of the args array and return an empty string if there
are no args.

That way it won't cause an IndexError if the args array is empty and it
tries to fetch the first element, which should be the Redis command.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 14:22:23 +00:00
Leighton Chen 3770e574eb
Add ability to exclude some routes explicitly with Django Instrumentation (#1618) 2023-02-03 15:14:28 -08:00
Tom de Bruijn 673e4aadb4
Record exception in Celery instrumentation (#1573)
* Add tests for errors in Celery tasks

I noticed there were no tests for the error scenario in the Celery
package. This commit adds a basic test, based on the previous test and
how I see other packages test the error status on the span.

Part of #987

* Record exception in Celery instrumentation

In addition to setting the status on the span, also record the exception
on the span. This adds an event to the span with more details about the
error, following the format other instrumentations also use.

* Update CHANGELOG with Celery record exception

* Fix lint code formatting issues

* Move Celery error tests to the functional tests

The celery tests failed on Python 3.11. This is most likely due to this
issue in billiard, a celery dependency, about it not working on Python
3.11 because of the error reported in the CI:
https://github.com/celery/billiard/issues/377

It's been fixed in billiard 4.1.0, but celery is locked on billiard
version lower than 4, so it cannot use this version with the fix.

This issue does not arise on the Docker tests, because they use Python
3.9.16.

I've moved the error test span event assertions to the error test that
is available in the functional tests, and removed the unit test. That
way, the build will run successfully.

* Remove duplicate entry in changelog

This was added in a recent merge commit on this PR branch.

* Remove unused test code

With the move of the tests for tasks with errors to the functional
tests, remove the unit test's error task and unused imports.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-03 04:30:57 +00:00
Srikanth Chekuri 520e58d62a
Update README.md (#1617) 2023-02-03 03:46:25 +00:00
Tom de Bruijn 78874df5c2
Fix install of Python 3.10 on GitHub Actions (#1609)
* Fix install of Python 3.10 on GitHub Actions

In PR #1604 the Python version was upgraded to Python 3.10 to fix a
local issue on M1 MacBooks.

The GitHub Action workflows now exit with the following message for the
docker-tests, spellcheck and lint checks, skipping these checks.

```
lint create: /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/.tox/lint
SKIPPED: InterpreterNotFound: python3.10
___________________________________ summary ____________________________________
SKIPPED:  lint: InterpreterNotFound: python3.10
  congratulations :)
```

Upgrade the Python version in the GitHub Actions workflow to fix this.

* Fix YAML interpretation of Python 3.10

* Upgrade Docker tests dependencies

Upgrade the asyncpg and psycopg2 packages, they don't work on Python
3.10.

This also fixes running these tests no M1 MacBooks.

* Fix linter issues merged into main

They went unnoticed while the CI didn't fail on the lint task not
working.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-03 08:37:24 +05:30
Anthony Mirabella d8788b68dd
Flush meter provider at end of lambda function handler (#1613)
* Flush meter provider at end of lambda function handler

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Update `force_flush()` check based on PR feedback

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

---------

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2023-02-01 19:13:53 +05:30
Estelle Poulin 6ed2c56eca
Value of trace_configs might be None (#1592) 2023-01-31 10:51:15 +00:00
Shalev Roda bbe7578d17
Fix sqlalchemy uninstrument (#1581) 2023-01-29 09:43:06 +05:30
Diego Hurtado a300d65ccf
Update some environments to 3.10 (#1604)
Fixes #1603
2023-01-28 03:57:38 +05:30
Jan Hutař 1c27b775f2
[docs] Fixing examples formating (#1585) 2023-01-26 13:42:22 +00:00
avzis 810d9825cd
mongo db - fix db statement capturing (#1512) 2023-01-24 03:15:28 +00:00
Srikanth Chekuri e1a1bada1f
Remove update-sha workflow (#1594) 2023-01-24 01:24:01 +05:30
Nimrod Shlagman cca90db86f
add aio_pika to tox (#1590) 2023-01-21 10:45:12 +05:30
pridhi-arora a8f86f6fc7
Modified tox.ini to fix the comment line (#1588) 2023-01-20 18:50:08 +00:00
CoLa d75e19768a
bugfix(opentelemetry-instrumentation-grpc): Add code() and details() to ServicerContext (#1578) 2023-01-20 17:30:25 +00:00
Srikanth Chekuri dd7afe0cc6
Automated release workflow (#1580) 2023-01-19 01:47:34 +05:30
avzis e23dd5c25a
add a test for urllib3 using NoOpTracerProvider (#1574) 2023-01-18 15:41:46 +05:30
Shalev Roda c92ba14316
Add metric instrumentation for urllib (#1553) 2023-01-15 10:03:05 +05:30
hasier 092d8c86bb
Fix ASGIGetter keys to fetch from actual carrier headers (#1435) 2023-01-12 21:24:04 +00:00
avzis 43d0c6cae3
fix the instantiation of NoOpTracerProvider (#1577) 2023-01-12 17:16:03 +00:00
Michele Mancioppi bf9a8e87a0
Implement aws.ecs.* resource attributes (#1212) 2023-01-11 21:35:02 +00:00
avzis 70187ff3a3
Pymongo capture collection name (#1555) 2023-01-11 12:47:54 +00:00
avzis d1dec9220b
add a test for urllib using NoOpTracerProvider (#1560) 2023-01-10 16:23:48 +00:00
avzis 494bf0999c
add a test for redis using NoOpTracerProvider (#1559) 2023-01-09 09:15:00 +00:00
Nimrod Shlagman 6d1550bb0b
add python-kafka to docs (#1552) 2023-01-07 05:19:39 +00:00
Nimrod Shlagman 3dc2f8ee30
add elasticsearch to docs (#1542) 2023-01-06 20:35:44 +00:00
Shalev Roda 1f0dda9865
Add uninstrument test for django (#1557) 2023-01-06 17:34:15 +00:00
Shalev Roda a97326d871
Add uninstrument test for starlette (#1558) 2023-01-06 22:34:49 +05:30
Federico Bond c1206d9c08
Fix typo in Django docs (#1562) 2023-01-06 09:54:27 +05:30
Nimrod Shlagman 1f96608388
Add aio_pika readthedocs documentation (#1504) 2023-01-04 05:26:37 +05:30
Nimrod Shlagman de4cde7e33
add tortoiseorm docs (#1541) 2023-01-02 23:42:29 +05:30
Nimrod Shlagman abaa26381e
auto generate system metrics docs (#1530) 2023-01-01 22:43:13 +00:00
Shalev Roda 6d1c740eff
Add uninstrument test for boto3sqs (#1550) 2023-01-01 21:06:56 +00:00
avzis 346160467f
add a test using NoOpTracerProvider - sqlalchemy (#1508) 2023-01-01 18:33:34 +00:00
Nimrod Shlagman e79b313bd7
Add/aws lamda docs (#1534) 2023-01-01 23:32:20 +05:30
Vasi Vasireddy f38eeb73df
Update the usage of set-output command in GH actions (#1464) 2022-12-29 17:48:45 +00:00
Nimrod Shlagman 41438ba9d2
add docs/instrumentation component owner (#1535) 2022-12-27 14:29:32 +00:00
Shalev Roda 0518050a04
Add entry for urllib3 instrumentation component owner (#1536) 2022-12-27 19:20:14 +05:30
avzis 15ee4a0ac9
add a test for pymongo with NoOpTracer (#1537) 2022-12-27 07:38:30 +00:00
Nimrod Shlagman ddbc40f907
add pika to docs (#1540) 2022-12-27 12:39:49 +05:30
Nimrod Shlagman 426d641590
Add remoulade readthedocs documentation (#1515) 2022-12-22 19:29:29 +00:00
Shalev Roda 9fbb1febfe
Add uninstrument test for remoulade instrumentation (#1528) 2022-12-22 18:31:11 +00:00
Shalev Roda e7ff9a9be7
Add entry to component_owners.yml (#1511) 2022-12-22 17:31:05 +00:00
Alex Boten e106dbcd5a
[docs] fix broken link (#1513) 2022-12-22 22:30:21 +05:30
Nimrod Shlagman 33bb7be903
Add urllib readthedocs documentation (#1510) 2022-12-20 15:03:12 +00:00
Nimrod Shlagman 5af3519f36
fix aiopg version (#1473) 2022-12-20 20:00:11 +05:30
Alex Boten 7f8fe690a0
Adds an option to configure `disable_aws_context_propagation` by environment variable (#1507)
* Adds an option to configure `disable_aws_context_propagation` by environment variable

The variable `OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION` can be used to disable aws context propagation. This is similar to the proposed changes in the JS implementation: https://github.com/open-telemetry/opentelemetry-js-contrib/pull/1227

Signed-off-by: Alex Boten <aboten@lightstep.com>

* update changelog

* Apply suggestions from code review

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-12-19 16:50:36 -06:00
Shalev Roda a9f34136d2
Add uninstrument test for aws lambda (#1505) 2022-12-20 03:15:43 +05:30
Nimrod Shlagman 23f63a5328
add uninstrument test for Celery (#1490) 2022-12-18 14:46:26 +00:00
Shalev Roda 41592015a3
Add uninstrument test for boto (#1488) 2022-12-18 15:22:55 +05:30
Srikanth Chekuri 0f2451be26
Update version to 1.16.0.dev/0.37b0.dev (#1485) 2022-12-10 04:03:22 +05:30
Srikanth Chekuri 71781d3964
updating changelogs and version to 1.15.0-0.36b0 (#1482) 2022-12-10 02:33:51 +05:30
Srikanth Chekuri fc738c04a6
Pin tox version (#1480) 2022-12-08 16:39:48 -06:00
Miguel Alexandre 25a6535f26
Instrument newer versions (#1468) 2022-12-06 15:58:03 +00:00
avzis cfd017e5ec
fix enable_commenter functionality (#1440) 2022-12-06 20:22:38 +05:30
Shalev Roda 99e0b42635
Add uninstrument test for sqlalchemy (#1471) 2022-12-05 22:28:10 +05:30
Sebastian Kreft bc57cc029d
fix(asgi-instrumentation): extract target after running the framework (#1461) 2022-12-05 02:00:09 +00:00
Artem Rys 155fc46596
Minor refactoring (#1169)
* Minor refactoring across multiple instrumentation libraries

* Reformat using black

* Put span_kind back in aws_lambda

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-12-03 13:11:06 +00:00
avzis 538c655830
Add a test for mysql instrumentation using NoOpTracerProvider (#1423) 2022-12-03 17:58:32 +05:30
Diego Hurtado b6f9b62de7
Refactor comments in .flake8 (#1470)
Fixes #1469
2022-11-29 14:04:48 +01:00
Mario Jonke 2179fb976f
botocore: Add support for SNS publish and publish_batch (#1409) 2022-11-24 16:44:12 +05:30
Alex Boten 8dbd1428c2
`opentelemetry-instrumentation-aws-lambda`: Adding option to disable context propagation (#1466)
* `opentelemetry-instrumentation-aws-lambda`: Adding option to disable context propagation

Adding the following option to disable context propagation `disable_aws_context_propagation`. This is similar to the disableAwsContextPropagation option in the nodejs instrumentation.

* update changelog

* lint

* more lint
2022-11-23 22:30:06 +01:00
Sean Kenny 80d0b89b8b
Add grpc.aio instrumentation to be auto-instrumented (#1442) 2022-11-22 03:24:21 +00:00
Anthony Shaw b6b269064c
Tortoise ORM instrumentation (#685) 2022-11-22 02:33:59 +00:00
Lance Erickson 9a155df802
Fix 1455: Protect from raw next() calls (#1456) 2022-11-21 17:39:23 -08:00
Diego Hurtado 6347ce0899
Fix httpx version (#1460)
Fixes #1459
2022-11-21 19:58:35 +01:00
Dan Rogers be4ceec08c
Strip leading comments from SQL queries when generating the span name. (#1434)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-11-18 14:01:07 +01:00
Diego Hurtado c613484390
Remove mention to eachdist (#1445) 2022-11-17 10:45:34 -08:00
Israël Hallé 725944d368
Urllib3 instrumentation can now retrieve urlopen body parameter when used as positional (#1398) 2022-11-16 01:30:22 +00:00
Robert Ayrapetyan ffb995d28b
opentelemetry-instrumentation-kafka-python: wait for metadata (#1260)
* fix kafka: wait for metadata

Kafka's instance metadata could be unavailable (because it's being filled asynchronously). extract_send_partition() is based on a metadata, so it may return `None` for partition and later cause all type of warning messages (e.g. `Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types`).
The proposed fix makes sure metadata is pre-populated (based on 4d598055da/kafka/producer/kafka.py (L579)).
I'm just not sure if we should wrap `_wait_on_metadata` into try\except, maybe just passing Exception to the caller would be a better idea...

* upd: changelog

* fix: changelog

* fix: import KafkaErrors

* fix: tox -e lint errors

* fix: refact and added unit test

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-11-15 12:42:56 +00:00
Dan Rogers 868049ecd9
Add support for regular expression matching and sanitizing of headers in Starlette. (#1404) 2022-11-15 01:35:24 +00:00
Srikanth Chekuri 47512c84b9
fix: No module named httpx (#1441) 2022-11-15 06:17:14 +05:30
saartochner e0f72095c5
feat: collecting messaging.* span attributes in botocore instrumentation (#1350) 2022-11-13 17:32:57 +00:00
luke6Lh43 5f85a5bd74
Remove db.name attribute from Redis instrumentation (#1427) 2022-11-10 19:21:44 +00:00
Nils Borrmann 7acc336cca
aiohttp-client: Allow overriding of span status (#1394) 2022-11-07 17:34:20 +00:00
Dan Rogers 496d6581cc
Add support for regular expression matching and sanitizing of headers in FastAPI. (#1403) 2022-11-07 22:23:08 +05:30
Dan Rogers 40e4e2e598
Fix dbapi connection instrument wrapper has no _sock member (#1424)
Fixes https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1353

Also:

Fix the check for the connection already being instrumented in instrument_connection()
Add tests for commit() and rollback()
Add a couple missing docstring items.
Add basepython to docker-tests to fix running the tests on macOS.
2022-11-07 16:00:28 +00:00
Shalev Roda f994e14636
Fix Urllib instrumentation - Add status code to span if not None (#1430) 2022-11-05 19:59:47 +05:30
Leighton Chen af972a07a9
Create RELEASING.md, Update version to 1.15.0.dev/0.36b0.dev (#1429) 2022-11-03 13:26:58 -07:00
Leighton Chen 05e23cd280
[release/v1.14.x-0.35bx] Prepare release 1.14.0/0.35b0 (#1428) 2022-11-03 10:30:35 -07:00
Leighton Chen 5c67dee23d
Change to use local dev versions (#1425) 2022-11-02 10:19:40 -07:00
Finlay 36264e97c3
Capture common HTTP attributes from API Gateway proxy events in Lambda instrumentor (#1233) 2022-11-02 04:27:09 +00:00
Dan Rogers a8cf644960
Add support for regular expression matching and sanitizing of headers in Django. (#1411) 2022-11-02 09:24:33 +05:30
Sean Kenny f58d16b47f
Add grpc.aio support (#1245) 2022-10-31 21:56:09 +00:00
Srikanth Chekuri 38d384a2ae
Add support for py3.11 (#1415) 2022-10-31 21:19:50 +00:00
Dan Rogers 339e0f3c7e
Add support for regular expression matching and sanitizing of headers in Falcon. (#1412) 2022-10-31 20:36:06 +00:00
Youssef Gamal 0dc16a4118
Update prom rw exporter (#1359) 2022-11-01 01:30:32 +05:30
Dan Rogers 26d3343428
Add support for regular expression matching and sanitizing of headers in Flask. (#1413)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-10-29 08:12:06 +00:00
Dan Rogers ff88520249
Add support for regular expression matching and sanitizing of headers in Pyramid. (#1414) 2022-10-29 13:08:19 +05:30
João Vieira 4383551135
Fix usage docs for confluent_kafka (#1400) 2022-10-27 12:48:55 +00:00
Ron Yishai 83f37eddf2
Deprecate otlp_proto_grpc and otlp_proto_http in auto-instrumentation (#1250) 2022-10-27 17:45:49 +05:30
Dan Rogers 542494146d
Add support for regular expression matching and sanitizing of headers in WSGI. (#1402) 2022-10-27 09:45:22 +05:30
Dan Rogers 9d6ba63e06
Add support for regular expression matching and sanitizing of headers in ASGI. (#1333) 2022-10-24 21:39:11 +05:30
Sebastian Kreft d5369a4431
feat(instrumentation/asgi): add target to metrics (#1323) 2022-10-22 13:29:53 +00:00
Adrian Garcia Badaracco 99f29b4b08
fix NonRecordSpan.attributes access (#1377) 2022-10-21 15:58:00 +00:00
Leighton Chen 75953f3b25
Use metric semantic conventions (#1380) 2022-10-19 12:31:01 -07:00
Kausik 9beb6b29b0
Requesting codeowner permission for sdk-extension/opentelemetry-sdk-extension-aws (#1379) 2022-10-14 10:11:39 -07:00
Shalev Roda 744851b3cf
metric instrumentation Tornado (#1252) 2022-10-12 21:52:12 +05:30
avzis c615fa74da
Add test for asgi using NoOpTracerProvider (#1367) 2022-10-11 08:11:53 +05:30
rbizos e15ee2b255
Fixing RichConsoleExporter to allow for multiple traces at once (#1336) 2022-10-10 16:57:02 +00:00
Vasi Vasireddy 9b8243cc94
Use compatible runtime for the dependency in opentelemetry-distro (#1373) 2022-10-09 00:29:42 +05:30
Jeremy Voss a47c45e61b
Adding try catch to fix ImproperlyConfigured exception while allowing (#1369) 2022-10-06 13:23:50 +00:00
Srikanth Chekuri 0adb306a8e
Remove DataDog exporter from main (#1366) 2022-10-06 10:46:31 +00:00
Srikanth Chekuri 93b8398b60
Pin importlib-metadata version (#1374) 2022-10-06 01:51:22 +05:30
krnr f349e380a2
asyncpg: Use only the first word from query as a span name (#1324) 2022-09-30 16:24:31 +05:30
Yulin Li 8e0c8d954b
collect threads count in opentelemetry-instrumentation-system-metrics (#1339)
* collect threads count in opentelemetry-instrumentation-system-metrics

* update

* avoid devidedByZero exception when sawp memory is 0

* add ut

* change log

* lint

* lint

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-09-28 11:46:01 +01:00
Yulin Li 9d8228f82f
avoid ZeroDevisionError exception when swap memory is 0 (#1345)
* avoid devidedByZero exception when sawp memory is 0

* lint

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-09-27 19:11:32 +01:00
Rahul Mukherjee fc98f0832e
Metrics instrumentation starlette (#1327) 2022-09-27 09:12:47 -07:00
Srikanth Chekuri 65329a89b0
Temporary fix for dd exporter publish 400 issue (#1357) 2022-09-27 14:08:23 +00:00
Srikanth Chekuri b2923e02fa
updating changelogs and version to 1.13.0-0.34b0 (#1352) 2022-09-27 03:12:18 +05:30
Srikanth Chekuri 44da384853
Minor updates to scripts (#1351) 2022-09-23 12:48:37 +05:30
Anshul Asawa 9a2285a42b
Metric instrumentation falcon (#1230) 2022-09-22 09:20:08 +00:00
Srikanth Chekuri 08db974e26
Revert "updated to remove directions from existing metrics. tests updated to … (#1213)" (#1346)
This reverts commit 270b73f55c.
2022-09-21 19:02:08 +02:00
Anshul Asawa 0b69786c30
fix flaky test in fastapi (#1344) 2022-09-21 01:29:35 +05:30
Anshul Asawa 9593eea808
Uninstruemnt existing instances before uninstrumenting falcon class (#1341) 2022-09-20 18:17:06 +00:00
Anshul Asawa 50b5465279
update pyramid readme (#1343) 2022-09-20 17:18:52 +00:00
Yoshi Yamaguchi 2ce0b69a8e
Add gRPC filter (#1241) 2022-09-20 09:47:27 -07:00
Lron d5ada286e1
Fix typo in opentelemetry-contrib-instrumentations/README.rst (#1340) 2022-09-19 21:56:48 +00:00
Anshul Asawa 2b7a0057da
uninstruemnt existing instances before uninstrumenting fastapi class (#1258) 2022-09-19 07:25:07 +00:00
rahuldimri 156203ca79
Spelling mistake on line number 133. (#1331) 2022-09-18 02:46:22 +00:00
Anshul Asawa 76a565e8bd
Update Readme for Pyramid Instrumentation (#1332) 2022-09-16 00:25:38 +05:30
Srikanth Chekuri 6753c872d2
Update tooling (#1330) 2022-09-15 23:42:49 +05:30
Srikanth Chekuri 273ae3cb57
Update package metadata for opentelemetry-instrumentation-remoulade (#1329) 2022-09-14 21:07:40 +05:30
Ofek Lev 41d8d10ad7
Update package metadata opentelemetry-instrumentation-starlette (#1297)
* Update package metadata

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

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-09-14 01:50:48 +05:30
Ofek Lev 791dc6b11f
Update package metadata opentelemetry-instrumentation-fastapi (#1278)
* Update package metadata

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

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-09-14 01:49:01 +05:30
Ofek Lev be9c71cb19
Update package metadata opentelemetry-exporter-datadog (#1261) 2022-09-14 00:58:07 +05:30
Ofek Lev 9424759973
Update package metadata opentelemetry-exporter-richconsole (#1262) 2022-09-14 00:54:38 +05:30
Ofek Lev b71e5fb2da
Update package metadata opentelemetry-instrumentation-aio-pika (#1263) 2022-09-14 00:54:15 +05:30
Ofek Lev 960bb4d932
Update package metadata opentelemetry-instrumentation-aiohttp-client (#1264) 2022-09-14 00:53:54 +05:30
Ofek Lev 4d9e46b465
Update package metadata opentelemetry-instrumentation-aiopg (#1265) 2022-09-14 00:51:45 +05:30
Ofek Lev d2d8789880
Update package metadata opentelemetry-instrumentation-asgi (#1266) 2022-09-14 00:50:41 +05:30
Ofek Lev 3f8ce38240
Update package metadata opentelemetry-instrumentation-asyncpg (#1267) 2022-09-14 00:46:23 +05:30
Ofek Lev b345570170
Update package metadata opentelemetry-instrumentation-aws-lambda (#1268) 2022-09-14 00:46:04 +05:30
Ofek Lev 545bd421ed
Update package metadata opentelemetry-instrumentation-boto (#1269) 2022-09-14 00:45:43 +05:30
Ofek Lev fcbff6f9db
Update package metadata opentelemetry-instrumentation-boto3sqs (#1270) 2022-09-14 00:45:21 +05:30
Ofek Lev 11c1ec8aa8
Update package metadata opentelemetry-instrumentation-botocore (#1271) 2022-09-14 00:45:01 +05:30
Ofek Lev ab8aa3776d
Update package metadata opentelemetry-instrumentation-celery (#1272) 2022-09-14 00:44:38 +05:30
Ofek Lev 70ad1223c9
Update package metadata opentelemetry-instrumentation-confluent-kafka (#1273) 2022-09-14 00:44:14 +05:30
Ofek Lev 383e5e1c14
Update package metadata opentelemetry-instrumentation-dbapi (#1274) 2022-09-14 00:43:47 +05:30
Ofek Lev e5bbf78d07
Update package metadata opentelemetry-instrumentation-django (#1275) 2022-09-14 00:43:20 +05:30
Ofek Lev b90c069eb0
Update package metadata opentelemetry-instrumentation-elasticsearch (#1276) 2022-09-14 00:42:56 +05:30
Ofek Lev a9c0f495de
Update package metadata opentelemetry-instrumentation-falcon (#1277) 2022-09-14 00:34:58 +05:30
Ofek Lev 119ec96974
Update package metadata opentelemetry-instrumentation-flask (#1279) 2022-09-14 00:34:21 +05:30
Ofek Lev 844e667c67
Update package metadata opentelemetry-instrumentation-grpc (#1280) 2022-09-14 00:34:02 +05:30
Ofek Lev 0975b24fb4
Update package metadata opentelemetry-instrumentation-httpx (#1281) 2022-09-14 00:33:42 +05:30
Ofek Lev 4c80bc7463
Update package metadata opentelemetry-instrumentation-jinja2 (#1282) 2022-09-14 00:33:23 +05:30
Ofek Lev e80539cf6f
Update package metadata opentelemetry-instrumentation-kafka-python (#1283) 2022-09-14 00:33:03 +05:30
Ofek Lev 1d80855393
Update package metadata opentelemetry-instrumentation-logging (#1284) 2022-09-14 00:32:42 +05:30
Ofek Lev 965b762375
Update package metadata opentelemetry-instrumentation-mysql (#1285) 2022-09-14 00:32:24 +05:30
Ofek Lev 0ce266c790
Update package metadata opentelemetry-instrumentation-pika (#1286) 2022-09-14 00:32:00 +05:30
Ofek Lev 3cfbcda724
Update package metadata opentelemetry-instrumentation-psycopg2 (#1287) 2022-09-14 00:31:36 +05:30
Ofek Lev a61b78df23
Update package metadata opentelemetry-instrumentation-pymemcache (#1288) 2022-09-14 00:25:36 +05:30
Ofek Lev 8c3e50172e
Update package metadata opentelemetry-instrumentation-pymongo (#1289) 2022-09-14 00:25:17 +05:30
Ofek Lev d1d8950e7d
Update package metadata opentelemetry-instrumentation-pymysql (#1290) 2022-09-14 00:24:41 +05:30
Ofek Lev 06624ba88f
Update package metadata opentelemetry-instrumentation-pyramid (#1291) 2022-09-14 00:24:19 +05:30
Ofek Lev 53312ea821
Update package metadata opentelemetry-instrumentation-redis (#1292) 2022-09-14 00:23:56 +05:30
Ofek Lev f045c43aff
Update package metadata opentelemetry-instrumentation-requests (#1293) 2022-09-14 00:23:35 +05:30
Ofek Lev 7c8e3072ec
Update package metadata opentelemetry-instrumentation-sqlalchemy (#1295) 2022-09-14 00:23:11 +05:30
Ofek Lev 7e0a4765ce
Update package metadata opentelemetry-instrumentation-sklearn (#1294) 2022-09-14 00:17:39 +05:30
Ofek Lev 1b0abfa55e
Update package metadata opentelemetry-instrumentation-sqlite3 (#1296) 2022-09-14 00:16:58 +05:30
Ofek Lev 66f2831c2b
Update package metadata opentelemetry-instrumentation-system-metrics (#1298) 2022-09-14 00:15:48 +05:30
Ofek Lev ba74fad557
Update package metadata opentelemetry-instrumentation-tornado (#1299) 2022-09-14 00:15:23 +05:30
Ofek Lev 2defc9df04
Update package metadata opentelemetry-instrumentation-urllib (#1300) 2022-09-14 00:14:59 +05:30
Ofek Lev bc63650c2e
Update package metadata (#1302) 2022-09-13 18:41:53 +00:00
Ofek Lev d2f44a6dee
Update package metadata opentelemetry-contrib-instrumentations (#1303) 2022-09-13 18:40:31 +00:00
Ofek Lev 52929a5194
Update package metadata opentelemetry-instrumentation-urllib3 (#1301) 2022-09-13 23:50:04 +05:30
Dan Rogers 4d341e8d95
Add support for sanitizing HTTP header values. (#1253)
First step of https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1184
2022-09-13 08:19:05 +00:00
Anshul Asawa 56530ebdfc
Metric instrumentation fastapi (#1199) 2022-09-12 20:11:58 +00:00
Anshul Asawa fee9926f50
Metric instrumentation pyramid (#1242) 2022-09-12 18:03:45 +05:30
Ofek Lev 318a3a3afc
Update package metadata opentelemetry-distro (#1304) 2022-09-10 17:21:24 +05:30
Ofek Lev debeba8cde
Update package metadata opentelemetry-instrumentation (#1305) 2022-09-10 08:55:10 +00:00
Ofek Lev f6c24698b6
Fix tooling (#1322)
* Update scripts/eachdist.py

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-09-10 14:06:42 +05:30
Anshul Asawa 4c2382338d
fix check of is_otel_instrumented (#1313) 2022-09-09 10:58:31 -07:00
amitsetty ff9651e5ff
Get rid of pymongo command in pymongo instrumentation span name (#1247) 2022-09-09 19:58:42 +05:30
Thiyagu55 32d7ff4082
Flask sqlalchemy psycopg2 integration (#1224) 2022-09-08 20:18:27 +00:00
petertamuk 270b73f55c
updated to remove directions from existing metrics. tests updated to … (#1214) 2022-09-08 11:03:26 -07:00
Ofek Lev b00701df86
Update package metadata opentelemetry-propagator-aws-xray (#1306) 2022-09-07 18:19:14 +00:00
Ofek Lev 09b509d92d
Use PEP 517 builds for tox (#1318) 2022-09-07 17:58:20 +00:00
Ofek Lev 2db44ba608
Update package metadata opentelemetry-util-http (#1309) 2022-09-07 17:38:04 +00:00
Ran Nozik 2d2b8769da
redis asyncio cluster version fix (#1311) 2022-09-07 17:13:24 +00:00
Ofek Lev 6f342b850d
Update package metadata opentelemetry-propagator-ot-trace (#1307) 2022-09-07 16:53:27 +00:00
Ofek Lev 49272a466c
Update package metadata (#1308) 2022-09-07 16:34:17 +00:00
Ofek Lev f66f546e61
Update package metadata _template (#1310) 2022-09-07 21:44:41 +05:30
Remi Rampin 3c24adf1b2
Fix broken links in package metadata (#1314) 2022-09-06 20:15:51 +00:00
Srikanth Chekuri 6af37e9fd8
fix: unquote peer ip (#1315) 2022-09-07 01:28:21 +05:30
Srikanth Chekuri 8107ad474b
Update README.md (#1257) 2022-09-01 11:15:35 -07:00
Gal Bashan 18e056b85a
Codespell ci (#1237) 2022-08-29 15:08:25 +05:30
Mario Jonke 934af7ea4f
aiohttp-client: Fix producing additional spans with each newly created ClientSession (#1246) 2022-08-27 13:03:28 +05:30
Diego Hurtado 03d97ffaf9
Remove support for 3.6 (#853) 2022-08-25 23:32:04 +05:30
Rahul Kumar 85e532816c
Added the Licence and Manifest file
Co-authored-by: Sunil Sunilshidrayi.wali@fmr.com
Co-authored-by: Rahuldimri rahul.dimri@fmr.com
2022-08-25 12:39:44 +05:30
Sanket Mehta 7382b5eed9
Restore metrics in django (#1208) 2022-08-24 20:25:32 +05:30
Yoshi Yamaguchi c2f9ebe382
fix typo in example codes (#1240) 2022-08-24 10:53:20 +05:30
Mario Jonke f48b3136c4
boto3sqs: Make propagation compatible with other instrumentations and add 'messaging.url' span attribute (#1234)
* boto3sqs: Fix various issues

* do not use 'otel' prefix for propagation keys to make propagation
  compatible with other SQS instrumentations like Node.Js
  Inject propergator.fields keys into the MessageAttributeNames argument
  for 'receive_message' calls to retreive the corresponding message attributes
* add 'messaging.url' span attribute to SQS spans
* add boto3sqs instrumentation to tox.ini to run tests in CI
* add some basic unit tests

* changelog

* fix linting issues

* unset instrumented flag on uninstrument
2022-08-23 09:29:58 +02:00
Diego Hurtado 7625b82dff
Release 1.12.0-0.33b0 (#1223)
* Release 1.12.0-0.33b0

* Update API and SDK versions to 1.12
2022-08-09 21:32:17 +02:00
Thomas Stringer 4d73a6b003
Fix Flask instrumentation doc link (#1216) 2022-08-09 06:14:23 +00:00
Shalev Roda be964036ae
Feature/metrics instrumentation urllib3 (#1198) 2022-08-09 05:49:55 +00:00
Anshul Asawa cbf005be6f
Metric instrumentation asgi (#1197) 2022-08-08 23:27:16 +05:30
Anshul Asawa ebe6d1804b
Metrics instrumentation flask (#1186) 2022-08-05 07:47:14 +00:00
Thiyagu55 14077a95c5
Adding sqlalchemy native tags in sqlalchemy commenter (#1206) 2022-08-04 18:43:12 +05:30
Srikanth Chekuri 04f4fe5076
ci: fix docs workflow failure (#1211) 2022-08-04 13:02:14 +02:00
Thiyagu55 fbac424515
Add psycopg2 native tags to sqlcommenter (#1203) 2022-07-30 05:14:47 +05:30
Thiyagu55 7c75b3867b
SQLCommenter semicolon bug fix (#1200) 2022-07-22 07:52:40 +05:30
Srikanth Chekuri d75194aed7
Sync with sdk setup from setUpClass to setUp (#1193) 2022-07-19 02:02:13 +05:30
shahargl 2ce69a668f
Add span for connection phase (#1134) 2022-07-17 21:09:15 +05:30
Thiyagu55 9e2dbecedc
Adding multiple db connections support for django-instrumentation's sqlcommenter (#1187) 2022-07-14 15:59:34 +05:30
Alex Boten 2eb86e06f9
[chore] update approvers list (#1191) 2022-07-12 00:47:11 +05:30
Leighton Chen 127518bb55
Adding sungwonh to component owners for redis (#1188) 2022-07-07 18:24:03 +02:00
Sungwon Han 8823655b1c
Instrument RedisCluster clients (#1177)
* Instrument RedisCluster clients

* reformat files

* update changelogs

* refactor _traced_execute_pipeline

* handle AttributeError

* handle IndexError

* refactor _traced_execute_pipeline

* move hasattr check to _set_connection_attributes function

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-07-07 15:00:09 +02:00
Diego Hurtado ee4083982f
Release 1.12.0rc2-0.32b0 (#1174) 2022-07-04 15:14:50 +02:00
Nikolay Sokolik 927565e23a
Change the entry for boto3sqs to work with auto instrumentation (#1176)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-07-04 13:53:06 +02:00
ofek1weiss ff412c6d40
Added aio-pika instrumentation (#1095) 2022-07-02 19:10:09 +05:30
Thiyagu55 ac84e9968f
Integrating sql commenter into otel_django_instrumentation (#896)
* Integrating sql commenter into otel_django_instrumentation

* Added test cases for django

* - Linting changes
- Added Changelog

* - Linting changes

* - Linting changes

* - Linting changes

* - Linting changes

* - Linting changes

* - Linting changes

* - Linting changes

* PR changes

* PR changes

* Linting changes

* Linting changes

* Linting changes

* Linting changes

* PR changes

* PR changes

* PR changes

* linting changes

* PR changes

* linting changes

* PR changes

* PR changes

* PR changes

* PR changes

* PR changes

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-06-29 12:06:25 +02:00
Nimrod Shlagman e267ebc645
Feat: instrument aiohttp with trace_configs argument (#1079) 2022-06-26 17:47:01 +05:30
Ashutosh Goel f7fd1e0693
Restoring metrics in requests (#1110) 2022-06-25 07:09:01 +05:30
Srikanth Chekuri 0007c9046c
Add metric instrumentation for WSGI (#1128) 2022-06-22 03:54:05 +05:30
Carol Abadeer 6503cdf2fe
Fix HTTP instrumentation not being suppressed (#1116) 2022-06-20 13:16:51 -07:00
Nina Stawski 62e0a31ff9
Pyramid: only categorize 500 exceptions as errors (#1137) 2022-06-17 03:37:34 +05:30
hemma f03bef2579
Add support to instrument multiple sqlalchemy engines (#1132)
* Override __new__ to instrument multiple engines

* add possibility to instrument mutiple engines

* update changelog

* update return type in doc

* fix CHANGELOG

* format

* fix test

* Check if engines isinstance Sequence

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-06-16 13:44:55 +02:00
Nina Stawski 4ba62140ad
pyramid: Only categorize 400s and 500s exceptions as errors (#1136)
* pyramid: Only categorize 400s and 500s exceptions as errors

* Added changelog entry for the fix

* Added a test for 204
2022-06-16 12:29:15 +02:00
Alex Boten 904f2f1332
system-metrics: fix typo in default configuration (#1135) 2022-06-15 09:42:20 -07:00
Diego Hurtado 99a028360e
Check keys in config before creating instruments (#1129)
* Check keys in config before creating instruments

Fixes #1125

* Fix lint
2022-06-14 15:59:32 +01:00
Aaron Abbott 51ba801bfd
Set OTLP grpc as the default metrics exporter for auto-instrumentation (#1127) 2022-06-10 03:05:44 +05:30
natashz ad15f7bc82
Logging instr hook (#1117) 2022-06-09 14:12:54 +05:30
Diego Hurtado 0bd8e4c7fd
Add psutil dependency (#1121)
* Add psutil dependency

Fixes #1120

* Update instrumentation/opentelemetry-instrumentation-system-metrics/setup.cfg

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-06-08 18:12:15 +01:00
Diego Hurtado f275e24925
Pass a list of metric readers (#1124)
Fixes #1123
2022-06-08 17:41:27 +01:00
Diego Hurtado 6876ad857f
Refactor TracedConnectionProxy (#1097)
* Refactor TracedConnectionProxy

Fixes #1077

* Remove unecessary methods
2022-06-07 18:20:59 +01:00
jerevoss 8afbce7533
Fixing inescapable character bug for Windows path string (#1100) 2022-06-04 02:54:50 +05:30
oxeye-dorkolog a8b9829f76
Support confluent kafka (#1111)
* add kafka instrumentation

* add confluent kafka instrumentation

* fix tests

* change documentation

* lint fix

* fix lint

Co-authored-by: Nikolay Sokolik <81902191+oxeye-nikolay@users.noreply.github.com>
2022-06-03 14:26:40 +01:00
ben-natan 5f7c293e0f
Add instrumentation for remoulade (#1082) 2022-05-31 14:05:41 -07:00
Leighton Chen c6f9dcd359
sphinx (#1115) 2022-05-31 12:24:44 -07:00
Alan Isaac 100ecfeb08
updated type hints for getters and setters (#1106) 2022-05-29 06:02:14 +05:30
Paul "TBBle" Hampson f7409b8b98
Typo fix: caputre => capture (#1108) 2022-05-27 11:27:40 +05:30
Paul "TBBle" Hampson 9d57a4c3ec
Narrow protobuf dependency to exclude protobuf >= 4 (#1109) 2022-05-27 01:18:24 +05:30
Nikolay Sokolik 8a7a3f1993
Feature/add boto3 sqs instrumentation (#1081)
* Add Boto3SQS Instrumentation

* Add basic tests

* Add context setting list

* Fix linting

* CR and lint fixes

* Add newline

* Run tox generate

* Change the dependency version

* Fix linting

* PR fixes. Remove walrus operator and use the `start_as_current_span`

* Run lint and generate

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-05-25 12:01:31 +02:00
Fischer Jemison a5ec3f7f55
Use a shorter timeout for AWS EC2 metadata requests (#1089)
* Use a shorter timeout for AWS EC2 metadata requests

Fix #1088 

According to the docs, the value for `timeout` is in seconds: https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen. 1000 seconds seems slow and in some cases can block the startup of the program being instrumented (see #1088 as an example), because the request will hang indefinitely in non-AWS environments. Using a much shorter 1 second timeout seems like a reasonable workaround for this.

* add changelog entry for timeout change

* use 5s timeout for ECS and EKS, update changelog

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-05-24 14:48:43 +02:00
Diego Hurtado 10659f8970
Release 1.12.0rc1-0.31b0 (#1094) 2022-05-17 13:18:55 -06:00
Diego Hurtado 9cb853e522
Use public metrics (#1093) 2022-05-17 09:36:08 +05:30
Mike Juarez 80969a06da
use sqlalchemy module name not engine. fixes #922 (#1086) 2022-05-11 15:08:19 +05:30
Aaron Abbott 3e67893cba
Update system metrics callbacks to accept CallbackOptions (#1084) 2022-05-10 21:52:58 +05:30
Ben Sully fa56c6c09f
Instrument redis.asyncio clients (#1076) 2022-05-05 06:39:29 +05:30
Aaron Abbott 2671ff53c8
Update system metrics to work with new metrics imports (#1075) 2022-04-29 10:05:15 +05:30
Nina Stawski a8edcf6a52
Make span attributes available to sampler in aiohttp_client (#1072) 2022-04-29 02:17:30 +05:30
Alex Boten 9e539391b2
[opentelemetry-instrumentation] add version flag (#1065) 2022-04-27 22:30:14 +05:30
Ashutosh Goel 6f620ee142
Refactoring custom header collection API for consistency (#1064) 2022-04-27 11:05:03 +05:30
Jakub Wach fedf9448c0
Fixes issue with headers not being a dict in AWS lambda instr (#1055) 2022-04-25 18:59:20 +05:30
Srikanth Chekuri b6964ccf3a
Release 1.11.1-0.30b1 (#1067) 2022-04-22 02:29:17 +05:30
Srikanth Chekuri 328e16f3f1
Remove datadog exporter from tox (#1069) 2022-04-22 01:38:13 +05:30
Diego Hurtado 9e0c2ce662
Rename Measurement to Observation (#1061) 2022-04-21 23:45:49 +05:30
Aaron Abbott c90935395f
Prune autoinstrumentation sitecustomize module directory from PYTHONPATH immediately (#1066) 2022-04-21 16:22:26 +05:30
Diego Hurtado 2f7a666560
Add Ashutosh Goel and Sanket Mehta to approvers (#1062)
* Add Ashutosh Goel and Sanket Mehta to approvers

Fixes #1053
Fixes #1054

* Adding company name for ashu658

* adding company name for sanketmehta28

Co-authored-by: Ashutosh Goel <39601429+ashu658@users.noreply.github.com>
Co-authored-by: sanket Mehta <sankmeht@cisco.com>
2022-04-20 10:11:18 -06:00
Leighton Chen 9ad41552b1
script (#1059) 2022-04-19 13:28:30 -06:00
Sanket Mehta 26a8aa184f
Starlette: capture custom request response headers in span attributes (#1046) 2022-04-18 23:42:38 +05:30
Leighton Chen 3ca7e7a5a3
Release 1.11.0-0.30b0 (#1056) 2022-04-18 10:04:18 -07:00
Leighton Chen 3690006954
Fix callbacks in system metrics instrumentation (#1057) 2022-04-15 20:55:52 +00:00
RJ Duffner abdd25f644
Add falcon version 1.4.1 support to opentelemetry-instrumentation-falcon (#1000) 2022-04-16 01:54:22 +05:30
Ken Robbins 4ad7592256
pyramid: Fix which package is the correct caller in _traced_init. (#830) 2022-04-15 03:18:09 +05:30
Nikolay Gribanov 9d14265911
Fix Tornado errors mapping to 500 (#1048) 2022-04-13 10:08:42 -07:00
Dipto Chakrabarty e9f83e1292
make span attribute available to urllib (#1014) 2022-04-12 20:37:46 +05:30
Ashutosh Goel 7deea055dd
Add docs to capture HTTP request/response headers (#1038) 2022-04-12 00:10:59 +05:30
Sanket Mehta 45448f8bb2
FastAPI: capture custom request response headers in span attributes (#1032) 2022-04-11 11:10:26 -07:00
Alex Boten 0fdc3c1656
[docs] update maintainers (#1045) 2022-04-09 01:16:44 +05:30
Ashutosh Goel 229dc4561f
Pyramid: Capture custom request/response headers (#1022) 2022-04-08 22:00:03 +05:30
Srikanth Chekuri d76066893b
Pin bleach to 4.1.0 (#1044) 2022-04-08 08:56:09 -07:00
Alex Boten 40c1805b11
`opentelemetry-instrumentation-system-metrics` restore package (#1012) 2022-04-06 10:54:22 -07:00
RJ Duffner b8cad79113
Update pymemcache instrumentation to support pymemcache version >= 1.3.5 (#935) 2022-04-06 08:55:51 -07:00
Srikanth Chekuri dbc3073bd2
Temporarily disable benchmarks workflow (#1031) 2022-04-05 12:40:11 -07:00
Sanket Mehta b1e94d6a6b
Django: Capture custom request/response headers (#1024) 2022-04-05 12:05:48 -07:00
Srikanth Chekuri 36ba621226
Fix multiple import errors (#1030) 2022-04-05 09:31:19 -07:00
Greg Buehler d1f3d51885
Pyramid handle non-HTTPException (#1001) 2022-04-01 10:56:38 -07:00
Sanket Mehta b1bf8d4a54
code change to add custom http and websocket request and response hea… (#1004)
* code change to add custom http and websocket request and response headers as span attributes. Issue: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/919

* adding entry to changelog

* changes after running "tox -e generate" locally

* - added server_span.is_recording() in _get_otel_send() just to make sure the span is recording before adding the attributes to span.
- changed span to current_span to make sure attributes are being added to proper span.

* removed commented code

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-03-28 19:05:08 -06:00
rahulgupta92 f8b877eebc
Update .instrument() call signature response_hook argument name in the header comments (#1015)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-03-28 11:36:42 -06:00
zhutianyu db478789e4
bugfix: correct generate search span_name (#1018) 2022-03-24 10:56:52 -07:00
rahulgupta92 8727bc3374
Correct minor typos in the codebase (#1019)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-03-22 23:20:48 -06:00
Patrice Chalin 1bb3dcf385
Update README.md (#1013)
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2022-03-21 11:04:33 -07:00
Ashutosh Goel 59ca95d12f
Falcon: Capture request/response headers as span attributes (#1003) 2022-03-21 10:23:06 -07:00
Thiyagu55 e861b93362
Extending SQLCommenter support of dbapi into psycopg2 (#940)
* Added configuration for sqlcommenter

* Fixed linting errors

* Updated CHANGELOG.md

* Unit test case for sqlcommenter in psycopg2

* Merge conflict resolved

* Update CHANGELOG.md

* psycopg2 sqlcommenter integration test

* linting changes

* linting changes

* linting changes

* linting changes

* linting changes

* version compatability issue fix

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
2022-03-17 19:19:30 -06:00
Owais Lone 2f74c9021c
Add opentelemetry-contrib-instrumentations meta package (#681) 2022-03-16 18:02:44 -06:00
Thiyagu55 abd01fbe99
Changed the format of traceparent id (#941) 2022-03-15 17:10:05 -07:00
Alex Boten 640b117ab8
fix non-recording bug (#999) 2022-03-15 10:50:33 -07:00
Ran Nozik 8fc95cab64
support topic as kwarg (#949) 2022-03-14 09:38:46 -07:00
Ashutosh Goel d86f1645da
Tornado: Capture custom request/response headers as span attributes (#950) 2022-03-11 11:30:45 -08:00
brett-bim 5539d1f35a
adding additional event sources (#926) 2022-03-11 10:39:01 -08:00
Diego Hurtado 7a0caed36f
updating changelogs and version to 1.10.0-0.29b0 (#995) (#996) 2022-03-10 17:49:49 -06:00
Owais Lone 1b7e8e44b2
Moving owais to approver (#953) 2022-03-10 15:10:12 -08:00
Alex Boten fcba751969
[instrumentation/wsgi] fix NonRecordingSpan bug (#957)
* [instrumentation/wsgi] fix NonRecordingSpan bug

There was a bug caused by accessing `.kind` on a NonRecordingSpan. Added a test to validate the fix.

Fix #956

* fix lint

* use is_recording

* fix lint

* fix lint

* fix lint
2022-03-10 12:02:49 -06:00
Munir Abdinur 1bf9e0c51f
datadog-apm: deprecate datadog exporter (#900) 2022-03-10 09:22:04 -08:00
Ashutosh Goel c60a7e46ab
Flask: Capture custom request/response headers as span attributes (#952)
* Capture request/response headers for flask

* Update changelog and fixed lint errors
2022-03-09 11:52:06 +00:00
Thiyagu55 dbb35a2946
Sqlcommenter integration into SQLAlchemy (#924)
* Integrating sqlcommenter into psycopg2

* Integrating sqlcommenter into psycopg2 - Converted public local variable into private

* Added test cases for sqlcommenter & PR Changes

* Code refactoring for generate sqlcommenter

* Added testcase for sqlcommenter integration into sqlalchemy

* updated change log

* updated to accept latest logs

* Updated lint changes

* Fixed errors due to linting

* Fixed linting errors

* Fixed linting errors

* Fixed linting errors

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-03-08 23:57:00 -06:00
Ashutosh Goel 2f5bbc416a
Capture custom request/response headers for wsgi and change in passing response_headers in django, pyramid (#925) 2022-03-07 09:41:46 -08:00
Trask Stalnaker 2ab66416ab
Make requests span attributes available to samplers (#931) 2022-03-04 11:00:37 -08:00
Remi Rampin 7bb29bd9ab
Fix typos (#929) 2022-03-02 14:03:34 -08:00
Ashutosh Goel ca5a4a16a5
Fixing build failures (#928) 2022-03-01 13:18:14 -08:00
Owais Lone 1080b04902
Safer patching for Falcon API (#895)
We replace Falcon API class with a partial callable. It is safer to
replace it with a sub-class of the base falcon.API class so any other
systems making assumptions about falcon don't fail.
2022-02-20 17:40:13 +05:30
Alex Boten 22cc215c6c
[build] bump pylint (#923)
* [build] bump pylint

Fixes #632

* apply lint suggestions

* specify encoding
2022-02-16 17:52:00 -06:00
Srikanth Chekuri d54b61e687
feat(instrumentation-dbapi): add experimental sql commenter capability (#908)
* feat(instrumentation-dbapi): add experimental sql commenter capability

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

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>

* Fix lint

* Add CHANGELOG entry

* Fix lint

* Fix lint again

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-11 10:14:26 -06:00
Sanket Mehta 454f4b1511
code changes to resolve conditional server span creation for WSGI and adding 'attributes' parameter to util function (#903)
* code changes to resolve conditional server span creation for WSGI (https://github.com/open-telemetry/opentelemetry-python-contrib/issues/454)

* Adding entry to changelog.md

* modifying _start_internal_or_server_span() to add attributes as a parameter. Also calling _start_internal_or_server_span() in WSGI instrumentation

* resolving flake8 and typo issues
2022-02-08 22:03:18 -06:00
Ran Nozik 0b9e96dae0
Support newer httpx versions (#866) 2022-02-04 09:07:31 -08:00
Owais Lone 8d309af49a
Logging: Defensively access provider resource (#890)
Now service name is extracted from the provider defensively and lazily.
This accounts for an SDK that does not provide access to "resource" via
TracerProviders and for lazy initialization of TracerProviders.

Fixes #810

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-03 12:00:15 -06:00
Sanket Mehta 0431d7b62f
adding unit test case for ASGI framework for application wrapped with… (#899)
* adding unit test case for ASGI framework for application wrapped with another framework

* resolving lint errors

* resolving generate build errors

* resolving flake errors

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-03 22:40:03 +05:30
Ashutosh Goel 0180b837ee
Adding unit tests for conditional server span creation in starlette (#897)
* Adding unit tests for conditional server span creation in starlette

* Adding changelog entry and renaming function

* Update CHANGELOG.md

Removing changelog entry

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-03 21:57:06 +05:30
Ashutosh Goel c0eba00244
Using _start_internal_or_server_span function in asgi interceptor (#898) 2022-02-03 09:36:15 -06:00
Ashutosh Goel 0e92d6add8
Mark span as internal in presence of another span for tornado and use (#889)
_start_internal_or_server_span function for flask, pyramid and django

Adding changelog entry

Adding unit test and fixing lint errors

Refactoring to use _start_internal_or_server_span function

Removing unwanted imports and variables

Fixing lint errors

adding changes from tox -e generate

Fixing build errors
2022-02-03 14:08:04 +05:30
Greg Buehler 0e553419c5
Handle null statuses in http_status_to_status_code (#823) 2022-02-02 10:53:43 -08:00
Oleg A e69030e94b
aiohttp instrumentation: Remove `span_name` from docs (#857) 2022-02-02 10:08:20 -08:00
Oleg A 895800fa1d
aiohttp instrumentation: correct url filter input type (#864)
* fix: correct _UrlFilterT

* docs: CHANGELOG.md update

* style: apply isort

* fix: add yarl to docs requirements

* Revert "fix: add yarl to docs requirements"

This reverts commit e482ba54fc.

* fix: add yarl to nitpick exceptions

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-02-01 16:04:49 -06:00
Alex Boten ad2594e166
fix broken jinja2 test (#892)
* fix broken jinja2 test

* fix test ...
2022-02-01 18:19:18 +00:00
Ran Nozik 2189e81da1
feat: support pymongo v4.0 (#876) 2022-02-01 17:16:16 +05:30
Owais Lone c8020cbea5
updating changelogs and version to 1.9.1-0.28b1 (#887)
* updating changelogs and version to 1.9.1-0.28b1

* Update CHANGELOG.md

Co-authored-by: Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>

* Update CHANGELOG.md

Co-authored-by: Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>

Co-authored-by: Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
2022-01-31 09:40:29 +00:00
Alex Boten 11103ffb9c
Add release cadence (#880)
* add note about monthly cadence

Update the release section of the readme to include the monthly cadence of releases.

Fixes #457

* add note about monthly cadence

Update the release section of the readme to include the monthly cadence of releases.

Fixes #457
2022-01-28 17:10:31 -06:00
Owais Lone 3ceab3b510
prepare_release script to ignore some packages/files (#885) 2022-01-28 11:24:11 -08:00
Craig Austin 14d0726d3c
Fix redis doc link (#884)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-01-28 18:58:15 +00:00
Ran Nozik ef7769c86e
fix: safe kafka partition extraction (#872)
* safe partition extraction

* update changelog
2022-01-28 21:32:50 +05:30
Phillip Verheyden e53c1da979
Add packaging as a required package for pika instrumentation (#882)
Fixes #881
2022-01-28 14:59:59 +05:30
Alex Boten d55d1dc0d6
[tests] use _NoOpTracer and _NoOpTracerProvider (#860)
* [tests] use _NoOpTracer and _NoOpTracerProvider

* update
2022-01-27 15:04:23 -06:00
Nathaniel Ruiz Nowell 089c2b8262
Release Botocore Instrumentation as 0.28b0 (#878) 2022-01-27 02:05:32 +05:30
Owais Lone f9b4d2b864
updating changelogs and version to 1.9.0-0.28b0 (#875) 2022-01-26 12:00:44 -06:00
Srikanth Chekuri 571c3780e6
(instrumentation-sqlite3): trace connections made with `dbapi2.connect` (#873)
* Change wrap_connect method

* Wrap both connect defs

* Add tests

* Add CHANGELOG entry
2022-01-26 00:19:25 +00:00
OHeimlich ec5b73c626
Support partial timelimit for celery tasks (#847) 2022-01-25 23:43:13 +00:00
Sanket Mehta b32be746e4
Develop/conditional server span pyramid (#869)
* code change to resolve the bug https://github.com/open-telemetry/opentelemetry-python-contrib/issues/449

* modifying the changelog file to add entry for PR #869

* removing redundent get statement

* Conditionally create server spans for falcon (#867)

* Making span as internal for falcon in presence of a span in current context

* Updating changelog

* Fixing lint and generate build failures

* Resolving comments: Converting snippet to re-usable function

* Fixing build failures

* Resolving comments: Creating wrapper for start span to make internal/server span

* Rerun docker tests

* Resolving comments: Refactoring

* Fix Django 1.9 issue preventing use of MIDDLEWARE_CLASSES (#870)

* Update CHANGELOG.md

* Fix Django 1.9 issue preventing use of MIDDLEWARE_CLASSES

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

* changing the import trace statement to resolve issue with unit test cases

Co-authored-by: Ashutosh Goel <39601429+ashu658@users.noreply.github.com>
Co-authored-by: Dan <pezzer55@gmail.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Owais Lone <owais@users.noreply.github.com>
2022-01-25 15:31:13 +00:00
jbraswell a2098c351e
add trailing_metadata to _OpenTelemetryServicerContext (#871)
The trailing_metadata method was added to grpc._server.ServicerContext
in gRPC v1.38.0.
2022-01-25 20:46:55 +05:30
Dan 91d65e033e
Fix Django 1.9 issue preventing use of MIDDLEWARE_CLASSES (#870)
* Update CHANGELOG.md

* Fix Django 1.9 issue preventing use of MIDDLEWARE_CLASSES

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2022-01-22 00:10:32 +05:30
Ashutosh Goel 8bb1e74ccf
Conditionally create server spans for falcon (#867)
* Making span as internal for falcon in presence of a span in current context

* Updating changelog

* Fixing lint and generate build failures

* Resolving comments: Converting snippet to re-usable function

* Fixing build failures

* Resolving comments: Creating wrapper for start span to make internal/server span

* Rerun docker tests

* Resolving comments: Refactoring
2022-01-21 10:24:01 -06:00
Leighton Chen dd72d94615
Revert moto change (#859) 2022-01-11 20:52:18 +00:00
Leighton Chen 741321434f
Add @nozik as maintainer of kafka-python instrumentation (#849) 2022-01-11 19:04:38 +00:00
Leighton Chen 23394ccd80
Unblock builds by removing botocore test (#851) 2022-01-11 10:24:18 -08:00
ItayGibel-helios e67a728be5
kafka-python instrumentation (#814) 2022-01-10 09:55:52 -08:00
Sanket Mehta d01efe5c50
Develop/condition server span django (#832)
* Code changes and pytests for https://github.com/open-telemetry/opentelemetry-python-contrib/issues/448

* removing unnecessary imports

* removing unnecessary imports

* adding wsgi.py file to get the wsgi application object

* Revert "Updating personal fork from public repo"

* Revert "Updating personal fork from public repo"

* Revert "Updating personal fork from public repo"

* Revert "Updating personal fork from public repo"

* Changing the unit test case by removing WSGI instrumentation and make it from generalised

* removing unnecessary import statements

* Revert "Updating personal fork from public repo"

* resolving failed builds for lint and generate

* removing commented code

* removing blank line

* removed unused variable resp from test_middleware.py and modified the CHANGELOG.md with PR entry

* modified the CHANGELOG.md to removed unnecessary entry

* modified the CHANGELOG.md to add proper PR entry

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2022-01-07 16:24:09 -06:00
Jakub Wach 4c813c47e4
ASGI: Conditionally create SERVER spans (#843) 2022-01-07 15:12:58 -06:00
Phillip Verheyden 3de29868a9
Add traceresponse headers for asgi apps (FastAPI, Starlette) (#817)
This asgi version is modeled after the original wsgi version in #436 and corresponds to the SERVER span. Also cleans up some of the existing ASGI functionality to reduce complexity and make future contributions more straightforward.
2021-12-25 21:52:28 +00:00
Ran Nozik 26aa17f8e9
Support older pika versions (#837)
* feat: support older pika versions

* update tox.ini

* update changelog

* take version from pika

* avoid exception when property name changes

* add callback attr name test
2021-12-26 03:03:22 +05:30
(Eliseo) Nathaniel Ruiz Nowell c962da908c
Merge parallel benchmarks + include propagator + latest GH action (#838)
* Include propagator benchmarks + latest GH action
* When we moved the aws-xray propagator in #720, we needed to update the benchmark step of the workflow
* Additionally, the GH action has evolved since we added benchmarks so we should use the latest version

* Merge all parallel benchmarks after they complete
2021-12-23 14:06:47 +05:30
Srikanth Chekuri 9219677adb
Fix CHANGELOG (#839) 2021-12-21 23:00:31 +05:30
Ashutosh Goel 30d0c2ea90
Conditionally create server spans for flask (#828)
* Making span as internal in presence of a span in current context

* Updating changelog

* Removing extra print statements

* Resolving comments: Setting current context as parent in its presence

* Ignoring pylint check as django.conf.urls.url is removed in django 4.0
Django release notes: https://docs.djangoproject.com/en/4.0/releases/4.0/

* Removing changes in django files
2021-12-20 11:48:59 +00:00
Owais Lone 0786aa49ad
updating changelogs and version to 1.8.0-0.27b0 (#835) 2021-12-17 22:34:57 +05:30
Jakub Wach 07f81461df
lambda instrumentation - support for flush timeout (#825)
* lambda instrumentation - support for flush timeout

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

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>

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

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>

* fixing lint

* fixing django lint

Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
2021-12-14 18:06:36 +05:30
Morgan McLean 444e0a1312
Remove direct Zoom link (#816)
Zoom links are randomized and in the calendar. Removed the existing link.
2021-11-23 22:28:08 +05:30
Anthony Shaw f0ac738ee1
Fix a logic bug on parentless spans (#782)
* Fix a logic bug on parentless spans

* Add a test

* Simplify logic

* Add changelog entry

* Update tox configuration

* Rename the fixtures to keep pylint happy
2021-11-19 17:25:33 +05:30
Nikolay Gribanov e6dff7e5d1
Add support instrumentation for Tornado 5.1.1 (#812)
* Add support instrumentation for Tornado 5.1.1

* update CHANGELOG.md
2021-11-17 17:34:25 +00:00
1200 changed files with 128758 additions and 14884 deletions

4
.codespellrc Normal file
View File

@ -0,0 +1,4 @@
[codespell]
# skipping auto generated folders
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv
ignore-words-list = ot

View File

@ -1,5 +1,4 @@
[run]
omit =
*/tests/*
*/setup.py
*/gen/*

23
.flake8
View File

@ -1,23 +0,0 @@
[flake8]
ignore =
E501 # line too long, defer to black
W503 # allow line breaks before binary ops
W504 # allow line breaks after binary ops
E203 # allow whitespace before ':' (https://github.com/psf/black#slices)
exclude =
.bzr
.git
.hg
.svn
.tox
CVS
.venv*/
venv*/
target
__pycache__
exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/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/

28
.github/CODEOWNERS vendored
View File

@ -1,26 +1,12 @@
# Code owners file.
# This file controls who is tagged for review for any given pull request.
#
# What is a "CODEOWNER"?
#
# A CODEOWNER lends their expertise to a specific package hosted by an OpenTelemetry repository.
#
# A CODEOWNER MUST:
# - introduce themselves on the CNCF OTel Python channel: https://cloud-native.slack.com/archives/C01PD4HUVBL
# - have enough knowledge of the corresponding instrumented library
# - respond to issues
# - fix failing unit tests or any other blockers to the CI/CD workflow
# - update usage of `opentelemetry-python-core` APIs upon the introduction of breaking changes
# - be a member of the OpenTelemetry community so that the `component-owners.yml` action to automatically assign CODEOWNERS to PRs works correctly.
#
# This file is only used as a way to assign any change to the approvers team
# except for a change in any of the instrumentations. The actual codeowners
# of the instrumentations are in .github/component_owners.yml.
# For anything not explicitly taken by someone else:
# Assigns any change to the approvers team...
* @open-telemetry/opentelemetry-python-contrib-approvers
# ...except for changes in any instrumentation.
/instrumentation
# Learn about CODEOWNERS file format:
# https://help.github.com/en/articles/about-code-owners
#
# Learn about membership in OpenTelemetry community:
# https://github.com/open-telemetry/community/blob/main/community-membership.md
#

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

@ -1,11 +1,83 @@
components:
docs/instrumentation:
- nemoshlag
instrumentation/opentelemetry-instrumentation-aio-pika:
- ofek1weiss
instrumentation/opentelemetry-instrumentation-boto3sqs:
- oxeye-nikolay
- nikosokolik
instrumentation/opentelemetry-instrumentation-asyncclick:
- jomcgi
instrumentation/opentelemetry-instrumentation-kafka-python:
- nozik
instrumentation/opentelemetry-instrumentation-pika:
- oxeye-nikolay
- nikosokolik
instrumentation/opentelemetry-instrumentation-redis:
- sungwonh
instrumentation/opentelemetry-instrumentation-remoulade:
- ben-natan
- machine424
instrumentation/opentelemetry-instrumentation-confluent-kafka:
- oxeye-dorkolog
- dorkolog
propagator/opentelemetry-propagator-aws-xray:
- NathanielRN
sdk-extension/opentelemetry-sdk-extension-aws:
- NathanielRN
- Kausik-A
- srprash
instrumentation/opentelemetry-instrumentation-tortoiseorm:
- tonybaloney
instrumentation/opentelemetry-instrumentation-tornado:
- shalevr
instrumentation/opentelemetry-instrumentation-urllib:
- shalevr
instrumentation/opentelemetry-instrumentation-urllib3:
- shalevr
instrumentation/opentelemetry-instrumentation-sqlalchemy:
- shalevr
instrumentation/opentelemetry-instrumentation-cassandra:
- mattcontinisio
instrumentation/opentelemetry-instrumentation-asyncio:
- bourbonkk
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

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

@ -0,0 +1,6 @@
#!/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_versions --versions stable,prerelease

View File

@ -0,0 +1,4 @@
#!/bin/bash -e
git config user.name opentelemetrybot
git config user.email 107717825+opentelemetrybot@users.noreply.github.com

43
.github/workflows/backport.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Backport
on:
workflow_dispatch:
inputs:
number:
description: "The pull request # to backport"
required: true
jobs:
backport:
runs-on: ubuntu-latest
steps:
- run: |
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x-0\.[0-9]+bx$ ]]; then
echo this workflow should only be run against long-term release branches
exit 1
fi
- uses: actions/checkout@v4
with:
# history is needed to run git cherry-pick below
fetch-depth: 0
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh
- name: Create pull request
env:
NUMBER: ${{ github.event.inputs.number }}
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid)
title=$(gh pr view $NUMBER --json title --jq .title)
branch="opentelemetrybot/backport-${NUMBER}-to-${GITHUB_REF_NAME//\//-}"
git cherry-pick $commit
git push origin HEAD:$branch
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

View File

@ -13,10 +13,12 @@ on:
jobs:
changelog:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
if: |
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')
&& github.actor != 'opentelemetrybot'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check for CHANGELOG changes
run: |
@ -31,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"

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

@ -0,0 +1,95 @@
name: Prepare patch release
on:
workflow_dispatch:
jobs:
prepare-patch-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x-0\.[0-9]+bx$ ]]; then
echo this workflow should only be run against long-term release branches
exit 1
fi
if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then
echo the change log is missing an \"Unreleased\" section
exit 1
fi
- name: Set environment variables
run: |
stable_version=$(./scripts/eachdist.py version --mode stable)
unstable_version=$(./scripts/eachdist.py version --mode prerelease)
if [[ $stable_version =~ ^([0-9]+\.[0-9]+)\.([0-9]+)$ ]]; then
stable_major_minor="${BASH_REMATCH[1]}"
stable_patch="${BASH_REMATCH[2]}"
else
echo "unexpected stable_version: $stable_version"
exit 1
fi
if [[ $unstable_version =~ ^0\.([0-9]+)b([0-9]+)$ ]]; then
unstable_minor="${BASH_REMATCH[1]}"
unstable_patch="${BASH_REMATCH[2]}"
else
echo "unexpected unstable_version: $unstable_version"
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-patch.sh $STABLE_VERSION $UNSTABLE_VERSION $STABLE_VERSION_PREV $UNSTABLE_VERSION_PREV
- 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 ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
- name: Use CLA approved github bot
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 }}
run: |
message="Prepare release ${STABLE_VERSION}/${UNSTABLE_VERSION}"
branch="opentelemetrybot/prepare-release-${STABLE_VERSION}-${UNSTABLE_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
pr_url=$(gh pr create --title "[$GITHUB_REF_NAME] $message" \
--body "$message." \
--head $branch \
--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

@ -0,0 +1,213 @@
name: Prepare release branch
on:
workflow_dispatch:
inputs:
prerelease_version:
description: "Pre-release version number? (e.g. 1.9.0rc2)"
required: false
jobs:
prereqs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify prerequisites
env:
PRERELEASE_VERSION: ${{ github.event.inputs.prerelease_version }}
run: |
if [[ $GITHUB_REF_NAME != main ]]; then
echo this workflow should only be run against main
exit 1
fi
if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then
echo the change log is missing an \"Unreleased\" section
exit 1
fi
if [[ ! -z $PRERELEASE_VERSION ]]; then
stable_version=$(./scripts/eachdist.py version --mode stable)
stable_version=${stable_version//.dev/}
if [[ $PRERELEASE_VERSION != ${stable_version}* ]]; then
echo "$PRERELEASE_VERSION is not a prerelease for the version on main ($stable_version)"
exit 1
fi
fi
create-pull-request-against-release-branch:
runs-on: ubuntu-latest
needs: prereqs
steps:
- uses: actions/checkout@v4
- name: Create release branch
env:
PRERELEASE_VERSION: ${{ github.event.inputs.prerelease_version }}
run: |
if [[ -z $PRERELEASE_VERSION ]]; then
stable_version=$(./scripts/eachdist.py version --mode stable)
stable_version=${stable_version//.dev/}
else
stable_version=$PRERELEASE_VERSION
fi
unstable_version=$(./scripts/eachdist.py version --mode prerelease)
unstable_version=${unstable_version//.dev/}
if [[ $stable_version =~ ^([0-9]+)\.([0-9]+)\.0$ ]]; then
stable_version_branch_part=$(echo $stable_version | sed -E 's/([0-9]+)\.([0-9]+)\.0/\1.\2.x/')
unstable_version_branch_part=$(echo $unstable_version | sed -E 's/0\.([0-9]+)b0/0.\1bx/')
release_branch_name="release/v${stable_version_branch_part}-${unstable_version_branch_part}"
elif [[ $stable_version =~ ^([0-9]+)\.([0-9]+)\.0 ]]; then
# pre-release version, e.g. 1.9.0rc2
release_branch_name="release/v$stable_version-$unstable_version"
else
echo "unexpected version: $stable_version"
exit 1
fi
git push origin HEAD:$release_branch_name
echo "STABLE_VERSION=$stable_version" >> $GITHUB_ENV
echo "UNSTABLE_VERSION=$unstable_version" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- name: Update version
run: .github/scripts/update-version.sh $STABLE_VERSION $UNSTABLE_VERSION
- 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 ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
- name: Use CLA approved github bot
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 }}
run: |
message="Prepare release ${STABLE_VERSION}/${UNSTABLE_VERSION}"
branch="opentelemetrybot/prepare-release-${STABLE_VERSION}-${UNSTABLE_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
pr_url=$(gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--head $branch \
--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@v4
- name: Set environment variables
env:
PRERELEASE_VERSION: ${{ github.event.inputs.prerelease_version }}
run: |
if [[ -z $PRERELEASE_VERSION ]]; then
stable_version=$(./scripts/eachdist.py version --mode stable)
stable_version=${stable_version//.dev/}
else
stable_version=$PRERELEASE_VERSION
fi
unstable_version=$(./scripts/eachdist.py version --mode prerelease)
unstable_version=${unstable_version//.dev/}
if [[ $stable_version =~ ^([0-9]+)\.([0-9]+)\.0$ ]]; then
stable_major="${BASH_REMATCH[1]}"
stable_minor="${BASH_REMATCH[2]}"
stable_next_version="$stable_major.$((stable_minor + 1)).0"
elif [[ $stable_version =~ ^([0-9]+)\.([0-9]+)\.0 ]]; then
# pre-release version, e.g. 1.9.0rc2
stable_major="${BASH_REMATCH[1]}"
stable_minor="${BASH_REMATCH[2]}"
stable_next_version="$stable_major.$stable_minor.0"
else
echo "unexpected stable_version: $stable_version"
exit 1
fi
if [[ $unstable_version =~ ^0\.([0-9]+)b[0-9]+$ ]]; then
unstable_minor="${BASH_REMATCH[1]}"
else
echo "unexpected unstable_version: $unstable_version"
exit 1
fi
unstable_next_version="0.$((unstable_minor + 1))b0"
echo "STABLE_VERSION=${stable_version}" >> $GITHUB_ENV
echo "STABLE_NEXT_VERSION=${stable_next_version}.dev" >> $GITHUB_ENV
echo "UNSTABLE_VERSION=${unstable_version}" >> $GITHUB_ENV
echo "UNSTABLE_NEXT_VERSION=${unstable_next_version}.dev" >> $GITHUB_ENV
- name: Update version
run: .github/scripts/update-version.sh $STABLE_NEXT_VERSION $UNSTABLE_NEXT_VERSION
- 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 ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
- name: Use CLA approved github bot
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 }}
run: |
message="Update version to ${STABLE_NEXT_VERSION}/${UNSTABLE_NEXT_VERSION}"
body="Update version to \`${STABLE_NEXT_VERSION}/${UNSTABLE_NEXT_VERSION}\`."
branch="opentelemetrybot/update-version-to-${STABLE_NEXT_VERSION}-${UNSTABLE_NEXT_VERSION}"
git commit -a -m "$message"
git push origin HEAD:$branch
pr_url=$(gh pr create --title "$message" \
--body "$body" \
--head $branch \
--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

@ -1,37 +0,0 @@
name: Publish
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Build wheels
run: ./scripts/build.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.
- 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/*

120
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,120 @@
name: Release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- run: |
if [[ $GITHUB_REF_NAME != release/* ]]; then
echo this workflow should only be run against release branches
exit 1
fi
- uses: actions/checkout@v4
- name: Set environment variables
run: |
stable_version=$(./scripts/eachdist.py version --mode stable)
unstable_version=$(./scripts/eachdist.py version --mode prerelease)
if [[ $stable_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
stable_major="${BASH_REMATCH[1]}"
stable_minor="${BASH_REMATCH[2]}"
stable_patch="${BASH_REMATCH[3]}"
else
echo "unexpected stable_version: $stable_version"
exit 1
fi
if [[ $stable_patch != 0 ]]; then
if [[ $unstable_version =~ ^0\.([0-9]+)b([0-9]+)$ ]]; then
unstable_minor="${BASH_REMATCH[1]}"
unstable_patch="${BASH_REMATCH[2]}"
else
echo "unexpected unstable_version: $unstable_version"
exit 1
fi
if [[ $unstable_patch != 0 ]]; then
prior_version_when_patch="$stable_major.$stable_minor.$((stable_patch - 1))/0.${unstable_minor}b$((unstable_patch - 1))"
fi
fi
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: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
# not making a patch release
if ! grep --quiet "^## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} " CHANGELOG.md; then
echo the pull request generated by prepare-release-branch.yml needs to be merged first
exit 1
fi
fi
# 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
# 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.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.
- 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: |
echo "VERSION=${STABLE_VERSION}\/${UNSTABLE_VERSION}" >> $GITHUB_ENV
./scripts/generate_release_notes.sh
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target $GITHUB_REF_NAME \
--title "Version ${STABLE_VERSION}/${UNSTABLE_VERSION}" \
--notes-file /tmp/release-notes.txt \
--discussion-category announcements \
v$UNSTABLE_VERSION
- uses: actions/checkout@v4
with:
# the step below is creating a pull request against main
ref: main

View File

@ -1,103 +0,0 @@
name: Contrib Repo Tests
on:
push:
branches-ignore:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 82a40052d2a49615b745fcbc890c9aabd6f88140
jobs:
build:
env:
# We use these variables to convert between tox and GHA version literals
py36: 3.6
py37: 3.7
py38: 3.8
py39: 3.9
py310: "3.10"
pypy3: pypy3
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: [ py36, py37, py38, py39, py310, pypy3 ]
package: ["instrumentation", "distro", "exporter", "sdkextension", "propagator"]
os: [ ubuntu-20.04 ]
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v2
with:
python-version: ${{ env[matrix.python-version] }}
- name: Install tox
run: pip install -U tox-factor
- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
uses: actions/cache@v2
with:
path: |
.tox
~/.cache/pip
key: v4-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 }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
- name: Find and merge benchmarks
# TODO: Add at least one benchmark to every package type to remove this (#249)
if: matrix.package == 'sdkextension'
run: >-
jq -s '.[0].benchmarks = ([.[].benchmarks] | add)
| if .[0].benchmarks == null then null else .[0] end'
**/**/tests/*${{ matrix.package }}*-benchmark.json > output.json
- name: Report on benchmark results
# TODO: Add at least one benchmark to every package type to remove this (#249)
if: matrix.package == 'sdkextension'
uses: rhysd/github-action-benchmark@v1
with:
name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }}
tool: pytest
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
max-items-in-chart: 100
# Alert with a commit comment on possible performance regression
alert-threshold: 200%
fail-on-alert: true
# Make a commit on `gh-pages` with benchmarks from previous step
auto-push: ${{ github.ref == 'refs/heads/main' }}
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmarks
misc:
strategy:
fail-fast: false
matrix:
tox-environment: [ "docker-tests", "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.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install tox
run: pip install -U 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@v2
with:
path: |
.tox
~/.cache/pip
key: v4-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

@ -3,15 +3,16 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
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
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.
ignore-patterns=
ignore-paths=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
@ -28,7 +29,7 @@ limit-inference-results=100
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.no_self_use
# Pickle collected data for later comparisons.
persistent=yes
@ -44,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]
@ -68,7 +72,6 @@ disable=missing-docstring,
duplicate-code,
ungrouped-imports, # Leave this up to isort
wrong-import-order, # Leave this up to isort
bad-continuation, # Leave this up to black
line-too-long, # Leave this up to black
exec-used,
super-with-arguments, # temp-pylint-upgrade
@ -80,6 +83,8 @@ disable=missing-docstring,
invalid-overridden-method, # temp-pylint-upgrade
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
@ -267,13 +272,6 @@ max-line-length=79
# Maximum number of lines in a module.
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
@ -497,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

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,39 @@ 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).
## Find a Buddy and get Started Quickly!
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
- [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
If you are looking for someone to help you find a starting point and be a resource for your first contribution, join our
Slack and find a buddy!
@ -27,33 +59,71 @@ context, reviewing PRs, and helping those get merged. Buddies will not be availa
## Development
To quickly get up and running, you can use the `scripts/eachdist.py` tool that
ships with this project. First create a virtualenv and activate it.
Then run `python scripts/eachdist.py develop` to install all required packages
as well as the project's packages themselves (in `--editable` mode).
You can then run `scripts/eachdist.py test` to test everything or
`scripts/eachdist.py lint` to lint everything (fixing anything that is auto-fixable).
This project uses [tox](https://tox.readthedocs.io) to automate
some aspects of development, including testing against multiple Python versions.
To install `tox`, run:
Additionally, this project uses [`tox`](https://tox.readthedocs.io) to automate some aspects
of development, including testing against multiple Python versions.
```sh
pip install tox
```
You can run:
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:
- `tox` to run all existing tox commands, including unit tests for all packages
```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
under multiple Python versions
- `tox -e py37-test-flask` to e.g. run the Flask 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 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
`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:
```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.
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:
@ -69,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
@ -84,30 +154,45 @@ pull requests (PRs).
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
git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git
cd opentelemetry-python-contrib
```
Add your fork as an origin:
```sh
$ git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git
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
$ git commit
$ git push fork feature
git checkout -b feature
```
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
```
Open a pull request against the main `opentelemetry-python-contrib` repo.
@ -116,11 +201,24 @@ 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
The maintainers and approvers of this repo are not experts in every instrumentation there is here.
In fact each one of us knows enough about them to only review a few. Unfortunately it can be hard
to find enough experts in every instrumentation to quickly review every instrumentation PR. The
instrumentation experts are listed in `.github/component_owners.yml` with their corresponding files
or directories that they own. The owners listed there will be notified when PRs that modify their
files are opened.
If you are not getting reviews, please contact the respective owners directly.
### How to Get PRs Merged
A PR is considered to be **ready to merge** when:
* It has received two approvals from [Approvers](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
/ [Maintainers](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer)
(at different companies).
@ -159,20 +257,32 @@ 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/main/.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
* docstrings should adhere to the [Google Python Style
Guide](http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
as specified with the [napolean
as specified with the [napoleon
extension](http://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#google-vs-numpy)
extension in [Sphinx](http://www.sphinx-doc.org/en/master/index.html).
@ -181,28 +291,85 @@ 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/semantic_conventions)
- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L26)
- 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/main/instrumentation/opentelemetry-instrumentation-requests/setup.cfg#L56)
- Run `python scripts/setup.py` followed by `python scripts/generate_instrumentation_bootstrap.py` after adding a new instrumentation package.
- Add an entry point (ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44>)
- Run `python scripts/generate_instrumentation_bootstrap.py` after adding a new instrumentation package.
- Functionality that is common amongst other instrumentation and can be abstracted [here](https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation)
- Request/response [hooks](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/408) for http instrumentations
- `suppress_instrumentation` functionality
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/3ec77360cb20482b08b30312a6bedc8b946e3fa1/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L111
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py#L191>
- Suppress propagation functionality
- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/344 for more context
- `exclude_urls` functionality
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L91
- `url_filter` functonality
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L235
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L327>
- `url_filter` functionality
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L268>
- `is_recording()` optimization on non-sampled spans
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L133
- 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/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L146
- 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 memebers of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.
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

@ -1,7 +1,7 @@
---
<p align="center">
<strong>
<a href="https://opentelemetry-python-contrib.readthedocs.io/en/latest/getting-started.html">Getting Started<a/>
<a href="https://opentelemetry.io/docs/instrumentation/python/getting-started/">Getting Started<a/>
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
<a href="https://opentelemetry-python-contrib.readthedocs.io/">API Documentation<a/>
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
@ -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,17 +33,26 @@
<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>
---
## OpenTelemetry Python Contrib
# OpenTelemetry Python Contrib
The Python auto-instrumentation libraries for [OpenTelemetry](https://opentelemetry.io/) (per [OTEP 0001](https://github.com/open-telemetry/oteps/blob/main/text/0001-telemetry-without-manual-instrumentation.md))
### Installation
## Index
* [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)
* [Thanks to all the people who already contributed](#thanks-to-all-the-people-who-already-contributed)
## Installation
This repository includes installable packages for each instrumented library. Libraries that produce telemetry data should only depend on `opentelemetry-api`,
and defer the choice of the SDK to the application developer. Applications may
@ -49,6 +61,8 @@ depend on `opentelemetry-sdk` or another package that implements the API.
**Please note** that these libraries are currently in _beta_, and shouldn't
generally be used in production environments.
Unless explicitly stated otherwise, any instrumentation here for a particular library is not developed or maintained by the authors of such library.
The
[`instrumentation/`](https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation)
directory includes OpenTelemetry instrumentation packages, which can be installed
@ -60,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}
@ -68,7 +82,7 @@ pip install -e ./instrumentation/opentelemetry-instrumentation-{integration}
## Releasing
Maintainers aim to periodically release new versions of the packages in `opentelemetry-python-contrib`.
Maintainers release new versions of the packages in `opentelemetry-python-contrib` on a monthly cadence. See [releases](https://github.com/open-telemetry/opentelemetry-python-contrib/releases) for all previous releases.
Contributions that enhance OTel for Python are welcome to be hosted upstream for the benefit of group collaboration. Maintainers will look for things like good documentation, good unit tests, and in general their own confidence when deciding to release a package with the stability guarantees that are implied with a `1.0` release.
@ -77,6 +91,7 @@ To resolve this, members of the community are encouraged to commit to becoming a
### Releasing a package as `1.0` stable
To release a package as `1.0` stable, the package:
- SHOULD have a CODEOWNER. To become one, submit an issue and explain why you meet the responsibilities found in [CODEOWNERS](.github/CODEOWNERS).
- MUST have unit tests that cover all supported versions of the instrumented library.
- e.g. Instrumentation packages might use different techniques to instrument different major versions of python packages
@ -84,44 +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.
Meetings take place via [Zoom video conference](https://zoom.us/j/8287234601?pwd=YjN2MURycXc4cEZlYTRtYjJaM0grZz09). The passcode is _77777_.
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
- [Alex Boten](https://github.com/codeboten), Lightstep
- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS
- [Srikanth Chekuri](https://github.com/lonewolf3739)
*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
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
### 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>

150
RELEASING.md Normal file
View File

@ -0,0 +1,150 @@
# Release instructions
## Preparing a new major or minor release
* Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/prepare-release-branch.yml).
* Press the "Run workflow" button, and leave the default branch `main` selected.
* If making a pre-release of stable components (e.g. release candidate),
enter the pre-release version number, e.g. `1.9.0rc2`.
(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`).
* 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
* Backport pull request(s) to the release branch.
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/backport.yml).
* 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`.
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/prepare-patch-release.yml).
* 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
* Run the [Release workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml).
* 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.
* This workflow will publish the artifacts and publish a GitHub release with release notes based on the change log.
* 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
* The version number for stable components in the `main` branch is always `X.Y.0.dev`,
where `X.Y.0` represents the next minor release.
* When the release branch is created, you can opt to make a "pre-release", e.g. `X.Y.0rc2`.
* If you ARE NOT making a "pre-release":
* A "long-term" release branch will be created, e.g. `release/v1.9.x-0.21bx` (notice the wildcard x's).
Later on, after the initial release, you can backport PRs to a "long-term" release branch and make patch releases
from it.
* The version number for stable components in the release branch will be bumped to remove the `.dev`,
e.g. `X.Y.0`.
* The version number for stable components in the `main` branch will be bumped to the next version,
e.g. `X.{Y+1}.0.dev`.
* If you ARE making a "pre-release":
* A "short-term" release branch will be created, e.g. `release/v1.9.0rc2-0.21b0` (notice the precise version with no
wildcard x's). "Short-term" release branches do not support backports or patch releases after the initial release.
* The version number for stable components in the `main` branch will not be bumped, e.g. it will remain `X.Y.0.dev`
since the next minor release will still be `X.Y.0`.
## Notes about version numbering for unstable components
* The version number for unstable components in the `main` branch is always `0.Yb0.dev`,
where `0.Yb0` represents the next minor release.
* _Question: Is "b" (beta) redundant on "0." releases, or is this a python thing? I'm wondering if we can change it to `0.Y.0` to match up with the practice in js and go repos._
* Unstable components do not need "pre-releases", and so whether or not you are making a "pre-release" of stable
components:
* The version number for unstable components in the release branch will be bumped to remove the `.dev`,
e.g. `0.Yb0`.
* The version number for unstable components in the `main` branch will be bumped to the next version,
e.g. `0.{Y+1}b0.dev`.
## Releasing dev version of new packages to claim namespace
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
### Publish failed
If for some reason the action failed, do it manually:
- Switch to the release branch (important so we don't publish packages with "dev" versions)
- Build distributions with `./scripts/build.sh`
- Delete distributions we don't want to push (e.g. `testutil`)
- Push to PyPI as `twine upload --skip-existing --verbose dist/*`
- Double check PyPI!

View File

@ -11,6 +11,7 @@ This library allows tracing requests made by the <REPLACE ME> library.
Installation
------------
::
pip install opentelemetry-instrumentation-<REPLACE ME>

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:

58
_template/pyproject.toml Normal file
View File

@ -0,0 +1,58 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
# opentelemetry-instrumentation plus the name of the library being instrument e.g
# name = "opentelemetry-instrumentation-sqlalchemy"
name = "<REPLACE ME>"
dynamic = ["version"]
# a description of the instrumentation e.g
# description = "SQLAlchemy tracing for OpenTelemetry"
description = "<REPLACE ME>"
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.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",
]
[project.entry-points.opentelemetry_instrumentor]
# REPLACE ME: the entrypoint for the instrumentor e.g
# sqlalchemy = "opentelemetry.instrumentation.sqlalchemy:SQLAlchemyInstrumentor"
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
# "src/opentelemetry/instrumentation/sqlalchemy/version.py"
path = "src/opentelemetry/instrumentation/<REPLACE ME>/version.py"
[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests",
]
[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]

View File

@ -1,59 +0,0 @@
# 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.
#
[metadata]
# opentelemetry-instrumentation plus the name of the library being instrument e.g
# name = opentelemetry-instrumentation-sqlalchemy
name = "<REPLACE ME>"
# a description of the instrumentation e.g
# description = SQLAlchemy tracing for OpenTelemetry
description = "<REPLACE ME>"
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
author_email = cncf-opentelemetry-contributors@lists.cncf.io
# url of the instrumentation e.g
# url = https://github.com/open-telemetry/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-sqlalchemy
url = "<REPLACE ME>"
platforms = any
license = Apache-2.0
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.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
[options]
python_requires = >=3.6
package_dir=
=src
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
[options.extras_require]
test =
# add any test dependencies here
"<REPLACE ME>"
[options.packages.find]
where = src

View File

@ -1,42 +0,0 @@
# 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 setuptools
BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
# REPLACE ME: the path to the version file e.g
# BASE_DIR, "src", "opentelemetry", "instrumentation", "sqlalchemy", "version.py"
BASE_DIR,
"src",
"opentelemetry",
"instrumentation",
"<REPLACE ME>",
"version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME, encoding="utf-8") as f:
exec(f.read(), PACKAGE_INFO)
setuptools.setup(
version=PACKAGE_INFO["__version__"],
entry_points={
"opentelemetry_instrumentor": [
# REPLACE ME: the entrypoint for the instrumentor e.g
# "sqlalchemy = opentelemetry.instrumentation.sqlalchemy:SQLAlchemyInstrumentor"
"<REPLACE ME> = opentelemetry.instrumentation.<REPLACE>"
]
},
)

View File

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

View File

@ -1,15 +1,18 @@
pylint<2.10
flake8~=3.7
isort~=5.6
black>=21.10b0
httpretty~=1.0
mypy==0.790
sphinx
sphinx-rtd-theme~=0.4
sphinx-autodoc-typehints
pytest!=5.2.3
pytest-cov>=2.8
readme-renderer~=24.0
grpcio-tools==1.29.0
mypy-protobuf>=1.23
protobuf>=3.13.0
pylint==3.0.2
httpretty==1.1.4
pyright==v1.1.396
sphinx==7.1.2
sphinx-rtd-theme==2.0.0rc4
sphinx-autodoc-typehints==1.25.2
pytest==7.4.4
pytest-cov==4.1.0
readme-renderer==42.0
bleach==4.1.0 # transient dependency for readme-renderer
markupsafe>=2.0.1
codespell==2.1.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

@ -1,39 +1,49 @@
sphinx
sphinx-rtd-theme~=0.4
sphinx-autodoc-typehints
# 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
sphinx==7.1.2
sphinx-rtd-theme==2.0.0rc4
sphinx-autodoc-typehints==1.25.2
# Required by opentelemetry-instrumentation
fastapi>=0.65.2
psutil~=5.7.0
pymemcache~=1.3
# Required by conf
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
flask~=1.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
pymongo~=3.1
PyMySQL~=0.9.3
mysqlclient~=2.1.1
openai >= 1.26.0
psutil>=5
psycopg~=3.1.17
pika>=0.12.0
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>=6.0
ddtrace>=0.34.0
httpx~=0.18.0
tornado>=5.1.1
tortoise-orm>=0.17.0
# indirect dependency pins
markupsafe==2.0.1
itsdangerous==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"]))
@ -54,7 +61,20 @@ sdk_ext_dirs = [
if isdir(join(sdk_ext, f))
]
sys.path[:0] = exp_dirs + instr_dirs + sdk_ext_dirs + prop_dirs
resource = "../resource"
resource_dirs = [
os.path.abspath("/".join(["../resource", f, "src"]))
for f in listdir(resource)
if isdir(join(resource, f))
]
sys.path[:0] = (
exp_dirs
+ instr_dirs
+ instr_genai_dirs
+ sdk_ext_dirs
+ prop_dirs
+ resource_dirs
)
# -- Project information -----------------------------------------------------
@ -102,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
@ -126,25 +147,14 @@ def getlistcfg(strval):
]
if "class_references" in mcfg:
class_references = getlistcfg(mcfg["class_references"])
for class_reference in class_references:
nitpick_ignore.append(
(
"py:class",
class_reference,
)
)
ignore_categories = ["py-class", "py-func", "py-exc", "py-obj", "any"]
for category in ignore_categories:
if category in mcfg:
items = getlistcfg(mcfg[category])
for item in items:
nitpick_ignore.append((category.replace("-", ":"), item))
if "anys" in mcfg:
anys = getlistcfg(mcfg["anys"])
for _any in anys:
nitpick_ignore.append(
(
"any",
_any,
)
)
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@ -183,13 +193,11 @@ scm_raw_web = "https://raw.githubusercontent.com/" + REPO + branch
scm_web = "https://github.com/" + REPO + "blob/" + branch
# Store variables in the epilogue so they are globally available.
rst_epilog = """
.. |SCM_WEB| replace:: {s}
.. |SCM_RAW_WEB| replace:: {sr}
.. |SCM_BRANCH| replace:: {b}
""".format(
s=scm_web, sr=scm_raw_web, b=branch
)
rst_epilog = f"""
.. |SCM_WEB| replace:: {scm_web}
.. |SCM_RAW_WEB| replace:: {scm_raw_web}
.. |SCM_BRANCH| replace:: {branch}
"""
# used to have links to repo files
extlinks = {

View File

@ -1,7 +0,0 @@
OpenTelemetry Datadog Exporter
==============================
.. automodule:: opentelemetry.exporter.datadog
:members:
:undoc-members:
:show-inheritance:

View File

@ -22,9 +22,9 @@ installed separately via pip:
pip install opentelemetry-exporter-{exporter}
pip install opentelemetry-instrumentation-{instrumentation}
pip install opentelemetry-sdk-extension-{sdkextension}
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.
@ -33,7 +33,7 @@ Extensions
Visit `OpenTelemetry Registry <https://opentelemetry.io/registry/?s=python>`_ to
find a lot of related projects like exporters, instrumentation libraries, tracer
implementations, etc.
implementations, resource, etc.
Installing Cutting Edge Packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -50,17 +50,11 @@ 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-containerid
.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Exporters
:name: exporters
:glob:
exporter/**
.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Instrumentations
@ -69,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
@ -93,6 +95,14 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
sdk-extension/**
.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Resource Detectors
:name: Resource Detectors
:glob:
resource/**
Indices and tables
------------------

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 @@
OpenTelemetry aio pika Instrumentation
============================================
.. automodule:: opentelemetry.instrumentation.aio_pika
: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 @@
OpenTelemetry asyncio Instrumentation
==============================================
.. automodule:: opentelemetry.instrumentation.asyncio
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,8 @@
OpenTelemetry AWS lambda Instrumentation
==========================================
.. automodule:: opentelemetry.instrumentation.aws_lambda
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,6 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-boto3sqs/README.rst
.. automodule:: opentelemetry.instrumentation.boto3sqs
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,7 @@
OpenTelemetry Cassandra Instrumentation
=======================================
.. automodule:: opentelemetry.instrumentation.cassandra
: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 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-confluent-kafka/README.rst
.. automodule:: opentelemetry.instrumentation.confluent_kafka
:members:
:undoc-members:
:show-inheritance:
:noindex:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
OpenTelemetry Psycopg Instrumentation
=====================================
OpenTelemetry Psycopg2 Instrumentation
======================================
.. automodule:: opentelemetry.instrumentation.psycopg2
:members:

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 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-remoulade/README.rst
.. automodule:: opentelemetry.instrumentation.remoulade
:members:
:undoc-members:
:show-inheritance:

View File

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

View File

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

View File

@ -0,0 +1,6 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-tortoiseorm/README.rst
.. automodule:: opentelemetry.instrumentation.tortoiseorm
:members:
:undoc-members:
:show-inheritance:

View File

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

View File

@ -1,5 +1,5 @@
[default]
class_references=
py-class=
; TODO: Understand why sphinx is not able to find this local class
opentelemetry.propagators.textmap.CarrierT
opentelemetry.propagators.textmap.Setter
@ -9,9 +9,11 @@ class_references=
opentelemetry.propagators.textmap.DefaultGetter
; API
opentelemetry.propagators.textmap.Getter
; - DatadogFormat
; - AWSXRayPropagator
opentelemetry.sdk.trace.id_generator.IdGenerator
opentelemetry.instrumentation.confluent_kafka.ProxiedProducer
opentelemetry.instrumentation.confluent_kafka.ProxiedConsumer
opentelemetry.instrumentation.instrumentor.BaseInstrumentor
; - AwsXRayIdGenerator
TextMapPropagator
CarrierT
@ -22,11 +24,29 @@ class_references=
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
func
Message
TopicPartition
callable
Consumer
confluent_kafka.Message
psycopg.Connection
psycopg.AsyncConnection
ObjectProxy
fastapi.applications.FastAPI
anys=
any=
; API
opentelemetry.propagators.textmap.TextMapPropagator.fields
; - AWSXRayPropagator
@ -36,7 +56,6 @@ anys=
; - AwsXRayIdGenerator
; SDK
SpanProcessor
; - DatadogExportSpanProcessor
TracerProvider
; - AwsXRayIdGenerator
; Instrumentation
@ -44,3 +63,23 @@ anys=
; - instrumentation.*
Setter
httpx
instrument
__iter__
list.__iter__
__getitem__
list.__getitem__
SQS.ReceiveMessage
py-obj=
opentelemetry.propagators.textmap.CarrierT
opentelemetry.instrumentation.dbapi.ConnectionT
opentelemetry.instrumentation.dbapi.CursorT
py-func=
poll
flush
Message.error
py-exc=
KafkaException
KafkaError

View File

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

View File

@ -16,7 +16,7 @@ sortfirst=
ext/*
[stable]
version=1.7.1
version=1.36.0.dev
packages=
opentelemetry-sdk
@ -34,13 +34,26 @@ packages=
opentelemetry-api
[prerelease]
version=0.26b1
version=0.57b0.dev
packages=
all
opentelemetry-semantic-conventions
opentelemetry-test-utils
opentelemetry-instrumentation
opentelemetry-contrib-instrumentations
opentelemetry-distro
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/

View File

@ -1,29 +0,0 @@
OpenTelemetry Datadog Exporter
==============================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-datadog.svg
:target: https://pypi.org/project/opentelemetry-exporter-datadog/
This library allows to export tracing data to `Datadog
<https://www.datadoghq.com/>`_. OpenTelemetry span event and links are not
supported.
Installation
------------
::
pip install opentelemetry-exporter-datadog
.. _Datadog: https://www.datadoghq.com/
.. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/
References
----------
* `Datadog <https://www.datadoghq.com/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_

View File

@ -1,52 +0,0 @@
# 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.
#
[metadata]
name = opentelemetry-exporter-datadog
description = Datadog Span Exporter for OpenTelemetry
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
author_email = cncf-opentelemetry-contributors@lists.cncf.io
url = https://github.com/open-telemetry/opentelemetry-python-contrib/exporter/opentelemetry-exporter-datadog
platforms = any
license = Apache-2.0
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.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
[options]
python_requires = >=3.6
package_dir=
=src
packages=find_namespace:
install_requires =
ddtrace>=0.34.0,<0.47.0
opentelemetry-api ~= 1.3
opentelemetry-sdk ~= 1.3
opentelemetry-semantic-conventions == 0.26b1
[options.packages.find]
where = src
[options.extras_require]
test =

View File

@ -1,77 +0,0 @@
# 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.
"""
The **OpenTelemetry Datadog Exporter** provides a span exporter from
`OpenTelemetry`_ traces to `Datadog`_ by using the Datadog Agent.
Installation
------------
::
pip install opentelemetry-exporter-datadog
Usage
-----
The Datadog exporter provides a span processor that must be added along with the
exporter. In addition, a formatter is provided to handle propagation of trace
context between OpenTelemetry-instrumented and Datadog-instrumented services in
a distributed trace.
.. code:: python
from opentelemetry.propagate import set_global_textmap
from opentelemetry import trace
from opentelemetry.exporter.datadog import DatadogExportSpanProcessor, DatadogSpanExporter
from opentelemetry.exporter.datadog.propagator import DatadogFormat
from opentelemetry.sdk.trace import TracerProvider
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)
exporter = DatadogSpanExporter(
agent_url="http://agent:8126", service="my-helloworld-service"
)
span_processor = DatadogExportSpanProcessor(exporter)
trace.get_tracer_provider().add_span_processor(span_processor)
# Optional: use Datadog format for propagation in distributed traces
set_global_textmap(DatadogFormat())
with tracer.start_as_current_span("foo"):
print("Hello world!")
Examples
--------
The `docs/examples/datadog_exporter`_ includes examples for using the Datadog
exporter with OpenTelemetry instrumented applications.
API
---
.. _Datadog: https://www.datadoghq.com/
.. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/
.. _docs/examples/datadog_exporter: https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/datadog_exporter
"""
# pylint: disable=import-error
from .exporter import DatadogSpanExporter
from .spanprocessor import DatadogExportSpanProcessor
__all__ = ["DatadogExportSpanProcessor", "DatadogSpanExporter"]

View File

@ -1,16 +0,0 @@
DD_ORIGIN = "dd_origin"
AUTO_REJECT = 0
AUTO_KEEP = 1
USER_KEEP = 2
SAMPLE_RATE_METRIC_KEY = "_sample_rate"
SAMPLING_PRIORITY_KEY = "_sampling_priority_v1"
ENV_KEY = "env"
VERSION_KEY = "version"
SERVICE_NAME_TAG = "service.name"
EVENT_NAME_EXCEPTION = "exception"
EXCEPTION_TYPE_ATTR_KEY = "exception.type"
EXCEPTION_MSG_ATTR_KEY = "exception.message"
EXCEPTION_STACK_ATTR_KEY = "exception.stacktrace"
DD_ERROR_TYPE_TAG_KEY = "error.type"
DD_ERROR_MSG_TAG_KEY = "error.msg"
DD_ERROR_STACK_TAG_KEY = "error.stack"

View File

@ -1,346 +0,0 @@
# 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 logging
import os
from urllib.parse import urlparse
from ddtrace.ext import SpanTypes as DatadogSpanTypes
from ddtrace.internal.writer import AgentWriter
from ddtrace.span import Span as DatadogSpan
import opentelemetry.trace as trace_api
from opentelemetry.exporter.datadog.constants import (
DD_ERROR_MSG_TAG_KEY,
DD_ERROR_STACK_TAG_KEY,
DD_ERROR_TYPE_TAG_KEY,
DD_ORIGIN,
ENV_KEY,
EVENT_NAME_EXCEPTION,
EXCEPTION_MSG_ATTR_KEY,
EXCEPTION_STACK_ATTR_KEY,
EXCEPTION_TYPE_ATTR_KEY,
SAMPLE_RATE_METRIC_KEY,
SERVICE_NAME_TAG,
VERSION_KEY,
)
from opentelemetry.sdk.trace import sampling
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
from opentelemetry.semconv.trace import SpanAttributes
logger = logging.getLogger(__name__)
DEFAULT_AGENT_URL = "http://localhost:8126"
_INSTRUMENTATION_SPAN_TYPES = {
"opentelemetry.instrumentation.aiohttp-client": DatadogSpanTypes.HTTP,
"opentelemetry.instrumentation.asgi": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.dbapi": DatadogSpanTypes.SQL,
"opentelemetry.instrumentation.django": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.flask": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.grpc": DatadogSpanTypes.GRPC,
"opentelemetry.instrumentation.jinja2": DatadogSpanTypes.TEMPLATE,
"opentelemetry.instrumentation.mysql": DatadogSpanTypes.SQL,
"opentelemetry.instrumentation.psycopg2": DatadogSpanTypes.SQL,
"opentelemetry.instrumentation.pymemcache": DatadogSpanTypes.CACHE,
"opentelemetry.instrumentation.pymongo": DatadogSpanTypes.MONGODB,
"opentelemetry.instrumentation.pymysql": DatadogSpanTypes.SQL,
"opentelemetry.instrumentation.redis": DatadogSpanTypes.REDIS,
"opentelemetry.instrumentation.requests": DatadogSpanTypes.HTTP,
"opentelemetry.instrumentation.sqlalchemy": DatadogSpanTypes.SQL,
"opentelemetry.instrumentation.wsgi": DatadogSpanTypes.WEB,
}
class DatadogSpanExporter(SpanExporter):
"""Datadog span exporter for OpenTelemetry.
Args:
agent_url: The url of the Datadog Agent or use ``DD_TRACE_AGENT_URL`` environment variable
service: The service name to be used for the application or use ``DD_SERVICE`` environment variable
env: Set the applications environment or use ``DD_ENV`` environment variable
version: Set the applications version or use ``DD_VERSION`` environment variable
tags: A list (formatted as a comma-separated string) of default tags to be added to every span or use ``DD_TAGS`` environment variable
"""
def __init__(
self, agent_url=None, service=None, env=None, version=None, tags=None
):
self.agent_url = (
agent_url
if agent_url
else os.environ.get("DD_TRACE_AGENT_URL", DEFAULT_AGENT_URL)
)
self.service = service or os.environ.get("DD_SERVICE")
self.env = env or os.environ.get("DD_ENV")
self.version = version or os.environ.get("DD_VERSION")
self.tags = _parse_tags_str(tags or os.environ.get("DD_TAGS"))
self._agent_writer = None
@property
def agent_writer(self):
if self._agent_writer is None:
url_parsed = urlparse(self.agent_url)
if url_parsed.scheme in ("http", "https"):
self._agent_writer = AgentWriter(
hostname=url_parsed.hostname,
port=url_parsed.port,
https=url_parsed.scheme == "https",
)
elif url_parsed.scheme == "unix":
self._agent_writer = AgentWriter(uds_path=url_parsed.path)
else:
raise ValueError(
f"Unknown scheme `{url_parsed.scheme}` for agent URL"
)
return self._agent_writer
def export(self, spans):
datadog_spans = self._translate_to_datadog(spans)
self.agent_writer.write(spans=datadog_spans)
return SpanExportResult.SUCCESS
def shutdown(self):
if self.agent_writer.started:
self.agent_writer.stop()
self.agent_writer.join(self.agent_writer.exit_timeout)
# pylint: disable=too-many-locals
def _translate_to_datadog(self, spans):
datadog_spans = []
for span in spans:
trace_id, parent_id, span_id = _get_trace_ids(span)
# datadog Span is initialized with a reference to the tracer which is
# used to record the span when it is finished. We can skip ignore this
# because we are not calling the finish method and explictly set the
# duration.
tracer = None
# extract resource attributes to be used as tags as well as potential service name
[
resource_tags,
resource_service_name,
] = _extract_tags_from_resource(span.resource, self.service)
datadog_span = DatadogSpan(
tracer,
_get_span_name(span),
service=resource_service_name,
resource=_get_resource(span),
span_type=_get_span_type(span),
trace_id=trace_id,
span_id=span_id,
parent_id=parent_id,
)
datadog_span.start_ns = span.start_time
datadog_span.duration_ns = span.end_time - span.start_time
if not span.status.is_ok:
datadog_span.error = 1
# loop over events and look for exception events, extract info.
# https://github.com/open-telemetry/opentelemetry-python/blob/71e3a7a192c0fc8a7503fac967ada36a74b79e58/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L810-L819
if span.events:
_extract_tags_from_exception_events(
span.events, datadog_span
)
# combine resource attributes and span attributes, don't modify existing span attributes
combined_span_tags = {}
combined_span_tags.update(resource_tags)
combined_span_tags.update(span.attributes)
datadog_span.set_tags(combined_span_tags)
# add configured env tag
if self.env is not None:
datadog_span.set_tag(ENV_KEY, self.env)
# add configured application version tag to only root span
if self.version is not None and parent_id == 0:
datadog_span.set_tag(VERSION_KEY, self.version)
# add configured global tags
datadog_span.set_tags(self.tags)
# add origin to root span
origin = _get_origin(span)
if origin and parent_id == 0:
datadog_span.set_tag(DD_ORIGIN, origin)
sampling_rate = _get_sampling_rate(span)
if sampling_rate is not None:
datadog_span.set_metric(SAMPLE_RATE_METRIC_KEY, sampling_rate)
# span events and span links are not supported except for extracting exception event context
datadog_spans.append(datadog_span)
return datadog_spans
def _get_trace_ids(span):
"""Extract tracer ids from span"""
ctx = span.get_span_context()
trace_id = ctx.trace_id
span_id = ctx.span_id
if isinstance(span.parent, trace_api.Span):
parent_id = span.parent.get_span_context().span_id
elif isinstance(span.parent, trace_api.SpanContext):
parent_id = span.parent.span_id
else:
parent_id = 0
trace_id = _convert_trace_id_uint64(trace_id)
return trace_id, parent_id, span_id
def _convert_trace_id_uint64(otel_id):
"""Convert 128-bit int used for trace_id to 64-bit unsigned int"""
return otel_id & 0xFFFFFFFFFFFFFFFF
def _get_span_name(span):
"""Get span name by using instrumentation and kind while backing off to
span.name
"""
instrumentation_name = (
span.instrumentation_info.name if span.instrumentation_info else None
)
span_kind_name = span.kind.name if span.kind else None
name = (
f"{instrumentation_name}.{span_kind_name}"
if instrumentation_name and span_kind_name
else span.name
)
return name
def _get_resource(span):
"""Get resource name for span"""
if SpanAttributes.HTTP_METHOD in span.attributes:
route = span.attributes.get(SpanAttributes.HTTP_ROUTE)
return (
span.attributes[SpanAttributes.HTTP_METHOD] + " " + route
if route
else span.attributes[SpanAttributes.HTTP_METHOD]
)
return span.name
def _get_span_type(span):
"""Get Datadog span type"""
instrumentation_name = (
span.instrumentation_info.name if span.instrumentation_info else None
)
span_type = _INSTRUMENTATION_SPAN_TYPES.get(instrumentation_name)
return span_type
def _get_exc_info(span):
"""Parse span status description for exception type and value"""
exc_type, exc_val = span.status.description.split(":", 1)
return exc_type, exc_val.strip()
def _get_origin(span):
ctx = span.get_span_context()
origin = ctx.trace_state.get(DD_ORIGIN)
return origin
def _get_sampling_rate(span):
ctx = span.get_span_context()
tracer_provider = trace_api.get_tracer_provider()
if not hasattr(tracer_provider, "sampler"):
return None
sampler = tracer_provider.sampler
return (
sampler.rate
if ctx.trace_flags.sampled
and isinstance(sampler, sampling.TraceIdRatioBased)
else None
)
def _parse_tags_str(tags_str):
"""Parse a string of tags typically provided via environment variables.
The expected string is of the form::
"key1:value1,key2:value2"
:param tags_str: A string of the above form to parse tags from.
:return: A dict containing the tags that were parsed.
"""
parsed_tags = {}
if not tags_str:
return parsed_tags
for tag in tags_str.split(","):
try:
key, value = tag.split(":", 1)
# Validate the tag
if key == "" or value == "" or value.endswith(":"):
raise ValueError
except ValueError:
logger.error(
"Malformed tag in tag pair '%s' from tag string '%s'.",
tag,
tags_str,
)
else:
parsed_tags[key] = value
return parsed_tags
def _extract_tags_from_resource(resource, fallback_service_name):
"""Parse tags from resource.attributes, except service.name which
has special significance within datadog"""
tags = {}
if not (resource and getattr(resource, "attributes", None)):
return [tags, fallback_service_name]
service_name = None
for attribute_key, attribute_value in resource.attributes.items():
if attribute_key == SERVICE_NAME_TAG:
service_name = attribute_value
else:
tags[attribute_key] = attribute_value
if service_name is None or service_name == "unknown_service":
service_name = fallback_service_name
return [tags, service_name]
def _extract_tags_from_exception_events(events, datadog_span):
"""Parse error tags from exception events, error.msg error.type
and error.stack have special significance within datadog"""
for event in events:
if event.name is not None and event.name == EVENT_NAME_EXCEPTION:
for key, value in event.attributes.items():
if key == EXCEPTION_TYPE_ATTR_KEY:
datadog_span.set_tag(DD_ERROR_TYPE_TAG_KEY, value)
elif key == EXCEPTION_MSG_ATTR_KEY:
datadog_span.set_tag(DD_ERROR_MSG_TAG_KEY, value)
elif key == EXCEPTION_STACK_ATTR_KEY:
datadog_span.set_tag(DD_ERROR_STACK_TAG_KEY, value)

View File

@ -1,148 +0,0 @@
# 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 typing
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.exporter.datadog import constants
from opentelemetry.propagators.textmap import (
CarrierT,
Getter,
Setter,
TextMapPropagator,
default_getter,
default_setter,
)
from opentelemetry.trace import get_current_span, set_span_in_context
class DatadogFormat(TextMapPropagator):
"""Propagator for the Datadog HTTP header format."""
TRACE_ID_KEY = "x-datadog-trace-id"
PARENT_ID_KEY = "x-datadog-parent-id"
SAMPLING_PRIORITY_KEY = "x-datadog-sampling-priority"
ORIGIN_KEY = "x-datadog-origin"
def extract(
self,
carrier: CarrierT,
context: typing.Optional[Context] = None,
getter: Getter = default_getter,
) -> Context:
if context is None:
context = Context()
trace_id = extract_first_element(
getter.get(carrier, self.TRACE_ID_KEY)
)
span_id = extract_first_element(
getter.get(carrier, self.PARENT_ID_KEY)
)
sampled = extract_first_element(
getter.get(carrier, self.SAMPLING_PRIORITY_KEY)
)
origin = extract_first_element(getter.get(carrier, self.ORIGIN_KEY))
trace_flags = trace.TraceFlags()
if sampled and int(sampled) in (
constants.AUTO_KEEP,
constants.USER_KEEP,
):
trace_flags = trace.TraceFlags(trace.TraceFlags.SAMPLED)
if trace_id is None or span_id is None:
return context
trace_state = []
if origin is not None:
trace_state.append((constants.DD_ORIGIN, origin))
span_context = trace.SpanContext(
trace_id=int(trace_id),
span_id=int(span_id),
is_remote=True,
trace_flags=trace_flags,
trace_state=trace.TraceState(trace_state),
)
return set_span_in_context(
trace.NonRecordingSpan(span_context), context
)
def inject(
self,
carrier: CarrierT,
context: typing.Optional[Context] = None,
setter: Setter = default_setter,
) -> None:
span = get_current_span(context)
span_context = span.get_span_context()
if span_context == trace.INVALID_SPAN_CONTEXT:
return
sampled = (trace.TraceFlags.SAMPLED & span.context.trace_flags) != 0
setter.set(
carrier,
self.TRACE_ID_KEY,
format_trace_id(span.context.trace_id),
)
setter.set(
carrier, self.PARENT_ID_KEY, format_span_id(span.context.span_id)
)
setter.set(
carrier,
self.SAMPLING_PRIORITY_KEY,
str(constants.AUTO_KEEP if sampled else constants.AUTO_REJECT),
)
if constants.DD_ORIGIN in span.context.trace_state:
setter.set(
carrier,
self.ORIGIN_KEY,
span.context.trace_state[constants.DD_ORIGIN],
)
@property
def fields(self):
"""Returns a set with the fields set in `inject`.
See
`opentelemetry.propagators.textmap.TextMapPropagator.fields`
"""
return {
self.TRACE_ID_KEY,
self.PARENT_ID_KEY,
self.SAMPLING_PRIORITY_KEY,
self.ORIGIN_KEY,
}
def format_trace_id(trace_id: int) -> str:
"""Format the trace id for Datadog."""
return str(trace_id & 0xFFFFFFFFFFFFFFFF)
def format_span_id(span_id: int) -> str:
"""Format the span id for Datadog."""
return str(span_id)
def extract_first_element(
items: typing.Iterable[CarrierT],
) -> typing.Optional[CarrierT]:
if items is None:
return None
return next(iter(items), None)

View File

@ -1,226 +0,0 @@
# 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 collections
import logging
import threading
import typing
from opentelemetry.context import Context, attach, detach, set_value
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
from opentelemetry.sdk.trace import Span, SpanProcessor
from opentelemetry.sdk.trace.export import SpanExporter
from opentelemetry.trace import INVALID_TRACE_ID
from opentelemetry.util._time import _time_ns
logger = logging.getLogger(__name__)
class DatadogExportSpanProcessor(SpanProcessor):
"""Datadog exporter span processor
DatadogExportSpanProcessor is an implementation of `SpanProcessor` that
batches all opened spans into a list per trace. When all spans for a trace
are ended, the trace is queues up for export. This is required for exporting
to the Datadog Agent which expects to received list of spans for each trace.
"""
_FLUSH_TOKEN = INVALID_TRACE_ID
def __init__(
self,
span_exporter: SpanExporter,
schedule_delay_millis: float = 5000,
max_trace_size: int = 4096,
):
if max_trace_size <= 0:
raise ValueError("max_queue_size must be a positive integer.")
if schedule_delay_millis <= 0:
raise ValueError("schedule_delay_millis must be positive.")
self.span_exporter = span_exporter
# queue trace_ids for traces with recently ended spans for worker thread to check
# for exporting
self.check_traces_queue = (
collections.deque()
) # type: typing.Deque[int]
self.traces_lock = threading.Lock()
# dictionary of trace_ids to a list of spans where the first span is the
# first opened span for the trace
self.traces = collections.defaultdict(list)
# counter to keep track of the number of spans and ended spans for a
# trace_id
self.traces_spans_count = collections.Counter()
self.traces_spans_ended_count = collections.Counter()
self.worker_thread = threading.Thread(target=self.worker, daemon=True)
# threading conditions used for flushing and shutdown
self.condition = threading.Condition(threading.Lock())
self.flush_condition = threading.Condition(threading.Lock())
# flag to indicate that there is a flush operation on progress
self._flushing = False
self.max_trace_size = max_trace_size
self._spans_dropped = False
self.schedule_delay_millis = schedule_delay_millis
self.done = False
self.worker_thread.start()
def on_start(
self, span: Span, parent_context: typing.Optional[Context] = None
) -> None:
ctx = span.get_span_context()
trace_id = ctx.trace_id
with self.traces_lock:
# check upper bound on number of spans for trace before adding new
# span
if self.traces_spans_count[trace_id] == self.max_trace_size:
logger.warning("Max spans for trace, spans will be dropped.")
self._spans_dropped = True
return
# add span to end of list for a trace and update the counter
self.traces[trace_id].append(span)
self.traces_spans_count[trace_id] += 1
def on_end(self, span: Span) -> None:
if self.done:
logger.warning("Already shutdown, dropping span.")
return
ctx = span.get_span_context()
trace_id = ctx.trace_id
with self.traces_lock:
self.traces_spans_ended_count[trace_id] += 1
if self.is_trace_exportable(trace_id):
self.check_traces_queue.appendleft(trace_id)
def worker(self):
timeout = self.schedule_delay_millis / 1e3
while not self.done:
if not self._flushing:
with self.condition:
self.condition.wait(timeout)
if not self.check_traces_queue:
# spurious notification, let's wait again, reset timeout
timeout = self.schedule_delay_millis / 1e3
continue
if self.done:
# missing spans will be sent when calling flush
break
# substract the duration of this export call to the next timeout
start = _time_ns()
self.export()
end = _time_ns()
duration = (end - start) / 1e9
timeout = self.schedule_delay_millis / 1e3 - duration
# be sure that all spans are sent
self._drain_queue()
def is_trace_exportable(self, trace_id):
return (
self.traces_spans_count[trace_id]
- self.traces_spans_ended_count[trace_id]
<= 0
)
def export(self) -> None:
"""Exports traces with finished spans."""
notify_flush = False
export_trace_ids = []
while self.check_traces_queue:
trace_id = self.check_traces_queue.pop()
if trace_id is self._FLUSH_TOKEN:
notify_flush = True
else:
with self.traces_lock:
# check whether trace is exportable again in case that new
# spans were started since we last concluded trace was
# exportable
if self.is_trace_exportable(trace_id):
export_trace_ids.append(trace_id)
del self.traces_spans_count[trace_id]
del self.traces_spans_ended_count[trace_id]
if len(export_trace_ids) > 0:
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
for trace_id in export_trace_ids:
with self.traces_lock:
try:
# Ignore type b/c the Optional[None]+slicing is too "clever"
# for mypy
self.span_exporter.export(self.traces[trace_id]) # type: ignore
# pylint: disable=broad-except
except Exception:
logger.exception(
"Exception while exporting Span batch."
)
finally:
del self.traces[trace_id]
detach(token)
if notify_flush:
with self.flush_condition:
self.flush_condition.notify()
def _drain_queue(self):
"""Export all elements until queue is empty.
Can only be called from the worker thread context because it invokes
`export` that is not thread safe.
"""
while self.check_traces_queue:
self.export()
def force_flush(self, timeout_millis: int = 30000) -> bool:
if self.done:
logger.warning("Already shutdown, ignoring call to force_flush().")
return True
self._flushing = True
self.check_traces_queue.appendleft(self._FLUSH_TOKEN)
# wake up worker thread
with self.condition:
self.condition.notify_all()
# wait for token to be processed
with self.flush_condition:
ret = self.flush_condition.wait(timeout_millis / 1e3)
self._flushing = False
if not ret:
logger.warning("Timeout was exceeded in force_flush().")
return ret
def shutdown(self) -> None:
# signal the worker thread to finish and then wait for it
self.done = True
with self.condition:
self.condition.notify_all()
self.worker_thread.join()
self.span_exporter.shutdown()

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