1833 Commits

Author SHA1 Message Date
901177a08e Update test.yml 2023-11-01 08:28:54 -07:00
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
3478831838 Using new cloud resource id attribute (#1976) 2023-10-09 19:02:52 +00:00
bb42e0417b Feature/add new process metrics (#1948) 2023-10-09 10:34:02 -07:00
7ac674430d Fix version of Flask dependency werkzeug (#1980) 2023-10-04 20:20:39 +00:00
e318c947a2 Update pyproject.toml (#1950) 2023-09-12 14:47:30 -07:00
4abb0e3216 Modify eachdist and build script for container packages (#1949) 2023-09-12 13:33:39 -07:00
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
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
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
a02d98cb38 Add Cassandra instrumentation (#1902) 2023-08-30 15:40:14 +00:00
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
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
9627f74a73 Azure resource detectors (#1901) 2023-08-17 13:21:59 -07:00
9cd9de7f01 Fix errors introduced in regression (#1913) 2023-08-16 13:25:50 -07:00
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
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
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
74fcbf4a6e Fix pyyaml version (#1892) 2023-07-18 18:49:51 +00:00
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
09efe708c3 Instrument mysqlclient library (#1744)
Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
2023-07-12 21:09:26 +02:00
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
db90ce38a2 Distro selection (#1823) 2023-07-11 20:26:14 +00:00
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
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
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
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
a45c9c3792 Update maintainers list (#1874) 2023-06-26 08:41:27 +02:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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 fd03c55a3902b3456afd6a2ecf429afba11b0691.

* botocore test does get_queue_url

* Revert "botocore test does get_queue_url"

This reverts commit 9530cd250dd836b3181a9361decb130e2aae1202.

* 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
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
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
a5ed4da478 Relax httpx version to allow >= 0.18.0 (#1748) 2023-06-13 13:07:28 +00:00
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
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
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
fc547877d3 Remove use of httpbin (#1854) 2023-06-13 10:30:52 +00:00
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