Skip to content

Commit 1d8a9b9

Browse files
authored
Merge branch 'main' into asgi-constructor-headers
2 parents 7713d63 + 773e431 commit 1d8a9b9

File tree

205 files changed

+1467
-758
lines changed

Some content is hidden

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

205 files changed

+1467
-758
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: d054dff47d2da663a39b9656d106c3d15f344269
9+
CORE_REPO_SHA: 9831afaff5b4d371fd9a14266ab47884546bd971
1010

1111
jobs:
1212
build:

.pylintrc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# A comma-separated list of package or module names from where C extensions may
44
# be loaded. Extensions are loading into the active Python interpreter and may
55
# run arbitrary code.
6-
extension-pkg-whitelist=
6+
extension-pkg-whitelist=cassandra
77

88
# Add list of files or directories to be excluded. They should be base names, not
99
# paths.
@@ -29,7 +29,7 @@ limit-inference-results=100
2929

3030
# List of plugins (as comma separated values of python modules names) to load,
3131
# usually to register additional checkers.
32-
load-plugins=
32+
load-plugins=pylint.extensions.no_self_use
3333

3434
# Pickle collected data for later comparisons.
3535
persistent=yes
@@ -69,7 +69,6 @@ disable=missing-docstring,
6969
duplicate-code,
7070
ungrouped-imports, # Leave this up to isort
7171
wrong-import-order, # Leave this up to isort
72-
bad-continuation, # Leave this up to black
7372
line-too-long, # Leave this up to black
7473
exec-used,
7574
super-with-arguments, # temp-pylint-upgrade
@@ -81,6 +80,7 @@ disable=missing-docstring,
8180
invalid-overridden-method, # temp-pylint-upgrade
8281
missing-module-docstring, # temp-pylint-upgrade
8382
import-error, # needed as a workaround as reported here: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/290
83+
cyclic-import,
8484

8585
# Enable the message, report, category or checker with the given id(s). You can
8686
# either give multiple identifier separated by comma (,) or put this option
@@ -268,13 +268,6 @@ max-line-length=79
268268
# Maximum number of lines in a module.
269269
max-module-lines=1000
270270

271-
# List of optional constructs for which whitespace checking is disabled. `dict-
272-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
273-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
274-
# `empty-line` allows space-only lines.
275-
no-space-check=trailing-comma,
276-
dict-separator
277-
278271
# Allow the body of a class to be on the same line as the declaration if body
279272
# contains single statement.
280273
single-line-class-stmt=no

CHANGELOG.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
- `opentelemetry-instrumentation-aiohttp-server` Add instrumentor and auto instrumentation support for aiohttp-server
11-
([#1800](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1800))
10+
### Added
11+
12+
- `opentelemetry-instrumentation` Added Otel semantic convention opt-in mechanism
13+
([#1987](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1987))
14+
- Add support for configuring ASGI middleware header extraction via runtime constructor parameters
15+
([#2026](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2026))
16+
17+
### Fixed
18+
19+
- `opentelemetry-instrumentation-urllib`/`opentelemetry-instrumentation-urllib3` Fix metric descriptions to match semantic conventions
20+
([#1959]((https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1959))
21+
22+
## Version 1.21.0/0.42b0 (2023-11-01)
1223

1324
### Added
25+
26+
- `opentelemetry-instrumentation-aiohttp-server` Add instrumentor and auto instrumentation support for aiohttp-server
27+
([#1800](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1800))
1428
- `opentelemetry-instrumentation-botocore` Include SNS topic ARN as a span attribute with name `messaging.destination.name` to uniquely identify the SNS topic
1529
([#1995](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1995))
1630
- `opentelemetry-instrumentation-system-metrics` Add support for collecting process metrics
1731
([#1948](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1948))
18-
- Add support for configuring ASGI middleware header extraction via runtime constructor parameters
19-
([#2026](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2026))
2032

2133
### Fixed
2234

2335
- Fix version of Flask dependency `werkzeug`
2436
([#1980](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1980))
2537
- `opentelemetry-resource-detector-azure` Using new Cloud Resource ID attribute.
2638
([#1976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1976))
39+
- Do not collect `system.network.connections` by default on macOS which was causing exceptions in metrics collection.
40+
([#2008](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2008))
2741

2842
## Version 1.20.0/0.41b0 (2023-09-01)
2943

@@ -54,6 +68,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5468
([#1824](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1824))
5569
- Fix sqlalchemy instrumentation wrap methods to accept sqlcommenter options
5670
([#1873](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1873))
71+
- Exclude background task execution from root server span in ASGI middleware
72+
([#1952](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1952))
5773

5874
### Added
5975

@@ -63,7 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6379
([#1744](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1744))
6480
- Fix async redis clients not being traced correctly
6581
([#1830](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1830))
66-
- Make Flask request span attributes available for `start_span`.
82+
- Make Flask request span attributes available for `start_span`.
6783
([#1784](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1784))
6884
- Fix falcon instrumentation's usage of Span Status to only set the description if the status code is ERROR.
6985
([#1840](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1840))
@@ -1385,6 +1401,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13851401
- `opentelemetry-ext-wsgi` Updates for core library changes
13861402
- `opentelemetry-ext-http-requests` Updates for core library changes
13871403

1404+
- `Added support for PyPy3` Initial release
1405+
## [#1033](https://github.com/open-telemetryopentelemetry-python-contrib/issues/1033)
1406+
13881407
## Version 0.1a0 (2019-09-30)
13891408

13901409
### Added

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ An easier way to do so is:
5252
2. Run `.tox/lint/bin/isort .`
5353

5454
See
55-
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python/blob/main/tox.ini)
55+
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
5656
for more detail on available tox commands.
5757

58+
### Troubleshooting
59+
60+
- 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.
61+
5862
### Benchmarks
5963

6064
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.

_template/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.42b0.dev"
15+
__version__ = "0.43b0.dev"

dev-requirements.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
pylint==2.12.2
2-
flake8~=3.7
3-
isort~=5.6
4-
black>=22.1.0
5-
httpretty~=1.0
6-
mypy==0.790
7-
sphinx
8-
sphinx-rtd-theme~=0.4
9-
sphinx-autodoc-typehints
10-
pytest!=5.2.3
11-
pytest-cov>=2.8
12-
readme-renderer~=24.0
1+
pylint==3.0.2
2+
flake8==6.1.0
3+
isort==5.12.0
4+
black==22.3.0
5+
httpretty==1.1.4
6+
mypy==0.931
7+
sphinx==7.1.2
8+
sphinx-rtd-theme==2.0.0rc4
9+
sphinx-autodoc-typehints==1.25.2
10+
pytest==7.1.3
11+
pytest-cov==4.1.0
12+
readme-renderer==42.0
1313
bleach==4.1.0 # transient dependency for readme-renderer
14-
grpcio-tools==1.29.0
15-
mypy-protobuf>=1.23
1614
protobuf~=3.13
1715
markupsafe>=2.0.1
1816
codespell==2.1.0
1917
requests==2.31.0
2018
ruamel.yaml==0.17.21
19+
flaky==3.7.0

docs-requirements.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
sphinx==4.5.0
2-
sphinx-rtd-theme~=0.4
3-
sphinx-autodoc-typehints
1+
sphinx==7.1.2
2+
sphinx-rtd-theme==2.0.0rc4
3+
sphinx-autodoc-typehints==1.25.2
44

55
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
66
# doesn't work for pkg_resources.
@@ -45,11 +45,8 @@ remoulade>=0.50
4545
sqlalchemy>=1.0
4646
tornado>=5.1.1
4747
tortoise-orm>=0.17.0
48-
ddtrace>=0.34.0
4948
httpx>=0.18.0
5049

5150
# indirect dependency pins
5251
markupsafe==2.0.1
5352
itsdangerous==2.0.1
54-
55-
docutils==0.16

eachdist.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sortfirst=
1616
ext/*
1717

1818
[stable]
19-
version=1.21.0.dev
19+
version=1.22.0.dev
2020

2121
packages=
2222
opentelemetry-sdk
@@ -34,7 +34,7 @@ packages=
3434
opentelemetry-api
3535

3636
[prerelease]
37-
version=0.42b0.dev
37+
version=0.43b0.dev
3838

3939
packages=
4040
all
@@ -54,6 +54,7 @@ packages=
5454
[lintroots]
5555
extraroots=examples/*,scripts/
5656
subglob=*.py,tests/,test/,src/*,examples/*
57+
ignore=sklearn
5758

5859
[testroots]
5960
extraroots=examples/*,tests/

exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.42b0.dev"
15+
__version__ = "0.43b0.dev"

exporter/opentelemetry-exporter-prometheus-remote-write/tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import pytest
44

55
import opentelemetry.test.metrictestutil as metric_util
6+
7+
# pylint: disable=no-name-in-module
68
from opentelemetry.exporter.prometheus_remote_write import (
79
PrometheusRemoteWriteMetricsExporter,
810
)

exporter/opentelemetry-exporter-prometheus-remote-write/tests/test_prometheus_remote_write_exporter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import pytest
1919

20+
# pylint: disable=no-name-in-module
2021
from opentelemetry.exporter.prometheus_remote_write import (
2122
PrometheusRemoteWriteMetricsExporter,
2223
)

exporter/opentelemetry-exporter-richconsole/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ classifiers = [
2727
dependencies = [
2828
"opentelemetry-api ~= 1.12",
2929
"opentelemetry-sdk ~= 1.12",
30-
"opentelemetry-semantic-conventions == 0.42b0.dev",
30+
"opentelemetry-semantic-conventions == 0.43b0.dev",
3131
"rich>=10.0.0",
3232
]
3333

exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.42b0.dev"
15+
__version__ = "0.43b0.dev"

instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ instruments = [
3535
]
3636
test = [
3737
"opentelemetry-instrumentation-aio-pika[instruments]",
38-
"opentelemetry-test-utils == 0.42b0.dev",
38+
"opentelemetry-test-utils == 0.43b0.dev",
3939
"pytest",
4040
"wrapt >= 1.0.0, < 2.0.0",
4141
]

instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/aio_pika_instrumentor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ async def wrapper(wrapped, instance, args, kwargs):
6464
def _instrument(self, **kwargs):
6565
tracer_provider = kwargs.get("tracer_provider", None)
6666
tracer = trace.get_tracer(
67-
_INSTRUMENTATION_MODULE_NAME, __version__, tracer_provider
67+
_INSTRUMENTATION_MODULE_NAME,
68+
__version__,
69+
tracer_provider,
70+
schema_url="https://opentelemetry.io/schemas/1.11.0",
6871
)
6972
self._instrument_queue(tracer)
7073
self._instrument_exchange(tracer)

instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.42b0.dev"
15+
__version__ = "0.43b0.dev"

instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ classifiers = [
2626
]
2727
dependencies = [
2828
"opentelemetry-api ~= 1.12",
29-
"opentelemetry-instrumentation == 0.42b0.dev",
30-
"opentelemetry-semantic-conventions == 0.42b0.dev",
31-
"opentelemetry-util-http == 0.42b0.dev",
29+
"opentelemetry-instrumentation == 0.43b0.dev",
30+
"opentelemetry-semantic-conventions == 0.43b0.dev",
31+
"opentelemetry-util-http == 0.43b0.dev",
3232
"wrapt >= 1.0.0, < 2.0.0",
3333
]
3434

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ def create_trace_config(
163163
# Explicitly specify the type for the `request_hook` and `response_hook` param and rtype to work
164164
# around this issue.
165165

166-
tracer = get_tracer(__name__, __version__, tracer_provider)
166+
tracer = get_tracer(
167+
__name__,
168+
__version__,
169+
tracer_provider,
170+
schema_url="https://opentelemetry.io/schemas/1.11.0",
171+
)
167172

168173
def _end_trace(trace_config_ctx: types.SimpleNamespace):
169174
context_api.detach(trace_config_ctx.token)

instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.42b0.dev"
15+
__version__ = "0.43b0.dev"

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import asyncio
1616
import contextlib
17+
import sys
1718
import typing
1819
import unittest
1920
import urllib.parse
@@ -116,14 +117,19 @@ def test_status_codes(self):
116117
status_code=status_code,
117118
)
118119

120+
url = f"http://{host}:{port}/test-path?query=param#foobar"
121+
# if python version is < 3.8, then the url will be
122+
if sys.version_info[1] < 8:
123+
url = f"http://{host}:{port}/test-path#foobar"
124+
119125
self.assert_spans(
120126
[
121127
(
122128
"GET",
123129
(span_status, None),
124130
{
125131
SpanAttributes.HTTP_METHOD: "GET",
126-
SpanAttributes.HTTP_URL: f"http://{host}:{port}/test-path#foobar",
132+
SpanAttributes.HTTP_URL: url,
127133
SpanAttributes.HTTP_STATUS_CODE: int(
128134
status_code
129135
),
@@ -134,14 +140,29 @@ def test_status_codes(self):
134140

135141
self.memory_exporter.clear()
136142

143+
def test_schema_url(self):
144+
with self.subTest(status_code=200):
145+
self._http_request(
146+
trace_config=aiohttp_client.create_trace_config(),
147+
url="/test-path?query=param#foobar",
148+
status_code=200,
149+
)
150+
151+
span = self.memory_exporter.get_finished_spans()[0]
152+
self.assertEqual(
153+
span.instrumentation_info.schema_url,
154+
"https://opentelemetry.io/schemas/1.11.0",
155+
)
156+
self.memory_exporter.clear()
157+
137158
def test_not_recording(self):
138159
mock_tracer = mock.Mock()
139160
mock_span = mock.Mock()
140161
mock_span.is_recording.return_value = False
141162
mock_tracer.start_span.return_value = mock_span
142163
with mock.patch("opentelemetry.trace.get_tracer"):
143164
# pylint: disable=W0612
144-
host, port = self._http_request(
165+
self._http_request(
145166
trace_config=aiohttp_client.create_trace_config(),
146167
url="/test-path?query=param#foobar",
147168
)

0 commit comments

Comments
 (0)