1802 Commits

Author SHA1 Message Date
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
26c673e7c9 Use HTTP mock server for aiohttp tests (#1849)
Fixes #1842
2023-06-13 08:40:41 +00:00
776f9d4643 Fix celery docker tests (#1841) 2023-06-13 10:07:45 +02:00
2edcc21ea2 skip urllib3 test on pypy3 (#1826) 2023-06-09 15:18:16 +02:00
a679754172 Update maintainers list (#1817) 2023-05-23 17:14:38 -06:00
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
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
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
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
db46e8eaab Skip requests tests for pypy3 (#1806) 2023-05-16 23:38:15 +05:30
1a1163e919 Expand sqlalchemy pool.name to follow the semantic conventions (#1778) 2023-05-06 23:09:52 +05:30
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
46e4b1da44 Add support for anonymous tasks (#1407) 2023-04-28 23:09:24 +00:00
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
c8b06539c0 Add support for pymemcache version > 4.0.0 (#1764) 2023-04-28 21:10:10 +05:30
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
19fe7713e2 Sanitize DB_STATEMENT by default for elasticsearch (#1758) 2023-04-23 22:55:05 +05:30
2d4e6c9ac7 fix: None does not implement middleware when there are no middlewares (#1766) 2023-04-19 22:53:21 +05:30
d01c96fb42 added request and response hooks for grpc client (#1706) 2023-04-15 16:48:57 +05:30
a7a4f71570 Prevent AttributeError from being raised when lambda event is a list (#1738) 2023-04-05 00:23:21 +05:30
e4d42e6632 Update runtime metrics to follow semantic conventions (#1735) 2023-04-04 01:54:35 +05:30
20d2cc311a Fix CHANGELOG (#1739) 2023-04-01 00:54:45 +05:30
27d6706f90 Pass request attributes to Sampler in Django (#1730) 2023-03-31 19:34:57 +05:30
4e059b15d2 Add exclude_list for urllib/urllib3 instrumentations (#1733)
* urllib

* urllib3

* Update __init__.py

* readme

* lint
2023-03-30 19:10:23 -06:00
5052190c13 skip instrumentation-boto* pypy env tests (#1737) 2023-03-30 17:52:07 -06:00
e4d8f10ecd Update version to 1.18.0.dev/0.39b0.dev (#1723) 2023-03-22 22:01:45 +05:30
1f67dcfeec Remove pinned version importlib-metadata (#1725) 2023-03-22 03:06:19 +05:30
2629c12161 Implement request and response hooks in requests library instrumentation (#1717) 2023-03-16 21:24:10 +00:00
fbec281553 Fix typo (#1721) 2023-03-16 11:38:13 +00:00
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
419975138b Fix httpx resource warnings (#1695) 2023-03-08 11:54:32 +00:00
e5d9ac5755 fix fastapi instrumentation tests for version 0.91 (#1710) 2023-03-07 20:29:24 +05:30