Skip to content

Commit 1bc4146

Browse files
committed
Merge branch 'main' of github.com:open-telemetry/opentelemetry-python-contrib into django-metrics-route
2 parents 6a7c0a1 + 7e48ee7 commit 1bc4146

File tree

147 files changed

+4344
-1166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+4344
-1166
lines changed

.github/workflows/instrumentations_0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ jobs:
127127
~/.cache/pip
128128
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
129129
- name: run tox
130-
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
130+
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra

.github/workflows/instrumentations_1.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
- "sdk-extension-aws"
3636
- "propagator-aws-xray"
3737
- "propagator-ot-trace"
38+
- "resource-detector-azure"
3839
- "resource-detector-container"
40+
- "util-http"
3941
os: [ubuntu-20.04]
4042
exclude:
4143
- python-version: pypy3
@@ -58,4 +60,4 @@ jobs:
5860
~/.cache/pip
5961
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
6062
- name: run tox
61-
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
63+
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- -ra

.github/workflows/lint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ jobs:
6868
- "processor-baggage"
6969
- "propagator-aws-xray"
7070
- "propagator-ot-trace"
71+
- "resource-detector-azure"
7172
- "resource-detector-container"
7273
- "sdk-extension-aws"
74+
- "util-http"
7375
os: [ubuntu-20.04]
7476
runs-on: ubuntu-20.04
7577
steps:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ _build/
5858
# mypy
5959
.mypy_cache/
6060
target
61+
62+
# Benchmark result files
63+
*-benchmark.json

CHANGELOG.md

+40-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
- `opentelemetry-instrumentation-aws-lambda` Bugfix: AWS Lambda event source key incorrect for SNS in instrumentation library.
11-
([#2612](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2612))
12-
- `opentelemetry-instrumentation-system-metrics` Permit to use psutil 6.0+.
13-
([#2630](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2630))
14-
1510
### Added
1611

1712
- `opentelemetry-instrumentation-pyramid` Record exceptions raised when serving a request
@@ -20,16 +15,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2015
([#2573](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2573))
2116
- `opentelemetry-instrumentation-confluent-kafka` Add support for version 2.4.0 of confluent_kafka
2217
([#2616](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2616))
18+
- `opentelemetry-instrumentation-asyncpg` Add instrumentation to cursor based queries
19+
([#2501](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2501))
2320
- `opentelemetry-instrumentation-confluent-kafka` Add support for produce purge
2421
([#2638](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2638))
22+
- `opentelemetry-instrumentation-asgi` Implement new semantic convention opt-in with stable http semantic conventions
23+
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
24+
- `opentelemetry-instrumentation-fastapi` Implement new semantic convention opt-in with stable http semantic conventions
25+
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
26+
- `opentelemetry-instrumentation-httpx` Implement new semantic convention opt-in migration with stable http semantic conventions
27+
([#2631](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2631))
28+
- `opentelemetry-instrumentation-system-metrics` Permit to use psutil 6.0+.
29+
([#2630](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2630))
30+
- `opentelemetry-instrumentation-system-metrics` Add support for capture open file descriptors
31+
([#2652](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2652))
32+
- `opentelemetry-instrumentation-aiohttp-client` Implement new semantic convention opt-in migration
33+
([#2673](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2673))
2534

2635
### Breaking changes
2736

2837
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-fastapi`, `opentelemetry-instrumentation-starlette` Use `tracer` and `meter` of originating components instead of one from `asgi` middleware
2938
([#2580](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2580))
39+
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `asgi` middleware
40+
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
41+
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `fastapi` middleware
42+
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
3043

3144
### Fixed
32-
45+
- Handle `redis.exceptions.WatchError` as a non-error event in redis instrumentation
46+
([#2668](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2668))
3347
- `opentelemetry-instrumentation-httpx` Ensure httpx.get or httpx.request like methods are instrumented
3448
([#2538](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2538))
3549
- Add Python 3.12 support
@@ -38,6 +52,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3852
([#2590](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2590))
3953
- Reference symbols from generated semantic conventions
4054
([#2611](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2611))
55+
- `opentelemetry-instrumentation-psycopg` Bugfix: Handle empty statement.
56+
([#2644](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2644))
57+
- `opentelemetry-instrumentation-confluent-kafka` Confluent Kafka: Ensure consume span is ended when consumer is closed
58+
([#2640](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2640))
59+
- `opentelemetry-instrumentation-asgi` Fix generation of `http.target` and `http.url` attributes for ASGI apps
60+
using sub apps
61+
([#2477](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2477))
62+
- `opentelemetry-instrumentation-aws-lambda` Bugfix: AWS Lambda event source key incorrect for SNS in instrumentation library.
63+
([#2612](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2612))
64+
- `opentelemetry-instrumentation-asyncio` instrumented `asyncio.wait_for` properly raises `asyncio.TimeoutError` as expected
65+
([#2637](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2637))
66+
- `opentelemetry-instrumentation-django` Handle exceptions from request/response hooks
67+
([#2153](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2153))
68+
- `opentelemetry-instrumentation-asgi` Removed `NET_HOST_NAME` AND `NET_HOST_PORT` from active requests count attribute
69+
([#2610](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2610))
70+
- `opentelemetry-instrumentation-asgi` Bugfix: Middleware did not set status code attribute on duration metrics for non-recording spans.
71+
([#2627](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2627))
72+
4173

4274
## Version 1.25.0/0.46b0 (2024-05-31)
4375

@@ -145,7 +177,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
145177
([#2136](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2136))
146178
- `opentelemetry-resource-detector-azure` Suppress instrumentation for `urllib` call
147179
([#2178](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2178))
148-
- AwsLambdaInstrumentor handles and re-raises function exception ([#2245](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2245))
180+
- AwsLambdaInstrumentor handles and re-raises function exception
181+
([#2245](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2245))
149182

150183
### Added
151184

CONTRIBUTING.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ for more detail on available tox commands.
9696
9797
### Benchmarks
9898

99-
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.
100-
101-
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.
99+
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.
102100

103101
To write benchmarks, simply use the [pytest benchmark fixture](https://pytest-benchmark.readthedocs.io/en/latest/usage.html#usage) like the following:
104102

@@ -114,10 +112,10 @@ def test_simple_start_span(benchmark):
114112
benchmark(benchmark_start_as_current_span, "benchmarkedSpan", 42)
115113
```
116114

117-
Make sure the test file is under the `tests/performance/benchmarks/` folder of
115+
Make sure the test file is under the `benchmarks/` folder of
118116
the package it is benchmarking and further has a path that corresponds to the
119117
file in the package it is testing. Make sure that the file name begins with
120-
`test_benchmark_`. (e.g. `propagator/opentelemetry-propagator-aws-xray/tests/performance/benchmarks/trace/propagation/test_benchmark_aws_xray_propagator.py`)
118+
`test_benchmark_`. (e.g. `propagator/opentelemetry-propagator-aws-xray/benchmarks/trace/propagation/test_benchmark_aws_xray_propagator.py`)
121119

122120
## Pull Requests
123121

@@ -271,6 +269,9 @@ Below is a checklist of things to be mindful of when implementing a new instrume
271269
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L234>
272270
- Appropriate error handling
273271
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L220>
272+
- Isolate sync and async test
273+
- 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.
274+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/60fb936b7e5371b3e5587074906c49fb873cbd76/instrumentation/opentelemetry-instrumentation-grpc/tests/test_aio_server_interceptor.py#L84>
274275

275276
## Expectations from contributors
276277

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Meeting notes are available as a public [Google doc](https://docs.google.com/doc
110110
Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telemetry/teams/python-approvers)):
111111

112112
- [Aaron Abbott](https://github.com/aabmass), Google
113+
- [Emídio Neto](https://github.com/emdneto), Zenvia
113114
- [Jeremy Voss](https://github.com/jeremydvoss), Microsoft
114115
- [Owais Lone](https://github.com/owais), Splunk
115116
- [Pablo Collins](https://github.com/pmcollins), Splunk
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
asgiref==3.7.2
2-
certifi==2024.2.2
2+
certifi==2024.7.4
33
charset-normalizer==3.3.2
4-
cramjam==2.8.1
4+
# We can drop this after bumping baseline to pypy-39
5+
cramjam==2.1.0; platform_python_implementation == "PyPy"
6+
cramjam==2.8.1; platform_python_implementation != "PyPy"
57
Deprecated==1.2.14
68
idna==3.7
79
importlib-metadata==6.11.0
@@ -11,12 +13,11 @@ pluggy==1.5.0
1113
protobuf==4.25.3
1214
py-cpuinfo==9.0.0
1315
pytest==7.4.4
14-
pytest-benchmark==4.0.0
1516
python-snappy==0.7.1
1617
requests==2.32.3
1718
tomli==2.0.1
1819
typing_extensions==4.10.0
1920
urllib3==2.2.2
2021
wrapt==1.16.0
21-
zipp==3.17.0
22+
zipp==3.19.2
2223
-e exporter/opentelemetry-exporter-prometheus-remote-write

exporter/opentelemetry-exporter-richconsole/test-requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ pluggy==1.5.0
1010
py-cpuinfo==9.0.0
1111
Pygments==2.17.2
1212
pytest==7.4.4
13-
pytest-benchmark==4.0.0
1413
rich==13.7.1
1514
tomli==2.0.1
1615
typing_extensions==4.10.0
1716
wrapt==1.16.0
18-
zipp==3.17.0
17+
zipp==3.19.2
1918
-e exporter/opentelemetry-exporter-richconsole

instrumentation/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
| Instrumentation | Supported Packages | Metrics support | Semconv status |
33
| --------------- | ------------------ | --------------- | -------------- |
44
| [opentelemetry-instrumentation-aio-pika](./opentelemetry-instrumentation-aio-pika) | aio_pika >= 7.2.0, < 10.0.0 | No | experimental
5-
| [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 | No | experimental
5+
| [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 | No | migration
66
| [opentelemetry-instrumentation-aiohttp-server](./opentelemetry-instrumentation-aiohttp-server) | aiohttp ~= 3.0 | No | experimental
77
| [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 2.0.0 | No | experimental
8-
| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 | No | experimental
8+
| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 | Yes | migration
99
| [opentelemetry-instrumentation-asyncio](./opentelemetry-instrumentation-asyncio) | asyncio | No | experimental
1010
| [opentelemetry-instrumentation-asyncpg](./opentelemetry-instrumentation-asyncpg) | asyncpg >= 0.12.0 | No | experimental
1111
| [opentelemetry-instrumentation-aws-lambda](./opentelemetry-instrumentation-aws-lambda) | aws_lambda | No | experimental
@@ -19,10 +19,10 @@
1919
| [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 | Yes | experimental
2020
| [opentelemetry-instrumentation-elasticsearch](./opentelemetry-instrumentation-elasticsearch) | elasticsearch >= 6.0 | No | experimental
2121
| [opentelemetry-instrumentation-falcon](./opentelemetry-instrumentation-falcon) | falcon >= 1.4.1, < 4.0.0 | Yes | experimental
22-
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi ~= 0.58 | Yes | experimental
22+
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi ~= 0.58 | Yes | migration
2323
| [opentelemetry-instrumentation-flask](./opentelemetry-instrumentation-flask) | flask >= 1.0 | Yes | migration
2424
| [opentelemetry-instrumentation-grpc](./opentelemetry-instrumentation-grpc) | grpcio ~= 1.27 | No | experimental
25-
| [opentelemetry-instrumentation-httpx](./opentelemetry-instrumentation-httpx) | httpx >= 0.18.0 | No | experimental
25+
| [opentelemetry-instrumentation-httpx](./opentelemetry-instrumentation-httpx) | httpx >= 0.18.0 | No | migration
2626
| [opentelemetry-instrumentation-jinja2](./opentelemetry-instrumentation-jinja2) | jinja2 >= 2.7, < 4.0 | No | experimental
2727
| [opentelemetry-instrumentation-kafka-python](./opentelemetry-instrumentation-kafka-python) | kafka-python >= 2.0 | No | experimental
2828
| [opentelemetry-instrumentation-logging](./opentelemetry-instrumentation-logging) | logging | No | experimental

instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ pamqp==3.1.0
1111
pluggy==1.5.0
1212
py-cpuinfo==9.0.0
1313
pytest==7.4.4
14-
pytest-benchmark==4.0.0
1514
tomli==2.0.1
1615
typing_extensions==4.9.0
1716
wrapt==1.16.0
1817
yarl==1.9.4
19-
zipp==3.17.0
18+
zipp==3.19.2
2019
-e opentelemetry-instrumentation
2120
-e instrumentation/opentelemetry-instrumentation-aio-pika

instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ pamqp==3.2.1
1111
pluggy==1.5.0
1212
py-cpuinfo==9.0.0
1313
pytest==7.4.4
14-
pytest-benchmark==4.0.0
1514
tomli==2.0.1
1615
typing_extensions==4.9.0
1716
wrapt==1.16.0
1817
yarl==1.9.4
19-
zipp==3.17.0
18+
zipp==3.19.2
2019
-e opentelemetry-instrumentation
2120
-e instrumentation/opentelemetry-instrumentation-aio-pika

instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ pamqp==3.2.1
1111
pluggy==1.5.0
1212
py-cpuinfo==9.0.0
1313
pytest==7.4.4
14-
pytest-benchmark==4.0.0
1514
tomli==2.0.1
1615
typing_extensions==4.9.0
1716
wrapt==1.16.0
1817
yarl==1.9.4
19-
zipp==3.17.0
18+
zipp==3.19.2
2019
-e opentelemetry-instrumentation
2120
-e instrumentation/opentelemetry-instrumentation-aio-pika

instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ pamqp==3.3.0
1111
pluggy==1.5.0
1212
py-cpuinfo==9.0.0
1313
pytest==7.4.4
14-
pytest-benchmark==4.0.0
1514
tomli==2.0.1
1615
typing_extensions==4.9.0
1716
wrapt==1.16.0
1817
yarl==1.9.4
19-
zipp==3.17.0
18+
zipp==3.19.2
2019
-e opentelemetry-instrumentation
2120
-e instrumentation/opentelemetry-instrumentation-aio-pika

0 commit comments

Comments
 (0)