Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ebracho authored Apr 1, 2024
2 parents 109630c + 24eadcf commit d9762cb
Show file tree
Hide file tree
Showing 157 changed files with 997 additions and 417 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/instrumentations_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
instrumentations-0:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/instrumentations_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
instrumentations-1:
Expand All @@ -31,7 +31,7 @@ jobs:
- "richconsole"
- "psycopg"
- "prometheus-remote-write"
- "sdkextension-aws"
- "sdk-extension-aws"
- "propagator-aws-xray"
- "propagator-ot-trace"
- "resource-detector-container"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: a1253585f66d63e7c05a19f070f3bfe0ab6460c1
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2

jobs:
misc:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
- `opentelemetry-instrumentation-django` Handle exceptions from request/response hooks ([#2153](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2153))

## Version 1.24.0/0.45b0 (2024-03-28)

- `opentelemetry-instrumentation-psycopg` Async Instrumentation for psycopg 3.x
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))

Expand All @@ -20,6 +22,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2297](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2297))
- Ensure all http.server.duration metrics have the same description
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2298))
- Fix regression in httpx `request.url` not being of type `httpx.URL` after `0.44b0`
([#2359](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2359))
- Avoid losing repeated HTTP headers
([#2266](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2266))
- `opentelemetry-instrumentation-elasticsearch` Don't send bulk request body as db statement
([#2355](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2355))
- AwsLambdaInstrumentor sets `cloud.account.id` span attribute
([#2367](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2367))

## Version 1.23.0/0.44b0 (2024-02-23)

Expand Down
6 changes: 0 additions & 6 deletions _template/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ dependencies = [
"opentelemetry-api ~= 1.12",
]

[project.optional-dependencies]
test = [
# add any test dependencies here
"<REPLACE ME>",
]

[project.entry-points.opentelemetry_instrumentor]
# REPLACE ME: the entrypoint for the instrumentor e.g
# sqlalchemy = "opentelemetry.instrumentation.sqlalchemy:SQLAlchemyInstrumentor"
Expand Down
2 changes: 1 addition & 1 deletion _template/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ 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
`Contrib repo instrumentation <https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation>`_
Expand Down
4 changes: 2 additions & 2 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sortfirst=
ext/*

[stable]
version=1.24.0.dev
version=1.25.0.dev

packages=
opentelemetry-sdk
Expand All @@ -34,7 +34,7 @@ packages=
opentelemetry-api

[prerelease]
version=0.45b0.dev
version=0.46b0.dev

packages=
all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ dependencies = [
"python-snappy ~= 0.6",
]

[project.optional-dependencies]
test = []

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-prometheus-remote-write"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
asgiref==3.7.2
attrs==23.2.0
certifi==2024.2.2
charset-normalizer==3.3.2
cramjam==2.8.1
Deprecated==1.2.14
idna==3.6
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==23.2
pluggy==1.4.0
protobuf==4.25.3
py==1.11.0
py-cpuinfo==9.0.0
pytest==7.1.3
pytest-benchmark==4.0.0
python-snappy==0.7.1
requests==2.31.0
tomli==2.0.1
typing_extensions==4.10.0
urllib3==2.2.1
wrapt==1.16.0
zipp==3.17.0
-e exporter/opentelemetry-exporter-prometheus-remote-write
5 changes: 1 addition & 4 deletions exporter/opentelemetry-exporter-richconsole/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ classifiers = [
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-sdk ~= 1.12",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.46b0.dev",
"rich>=10.0.0",
]

[project.optional-dependencies]
test = []

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/exporter/opentelemetry-exporter-richconsole"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
21 changes: 21 additions & 0 deletions exporter/opentelemetry-exporter-richconsole/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
asgiref==3.7.2
attrs==23.2.0
Deprecated==1.2.14
flaky==3.7.0
importlib-metadata==6.11.0
iniconfig==2.0.0
markdown-it-py==3.0.0
mdurl==0.1.2
packaging==23.2
pluggy==1.4.0
py==1.11.0
py-cpuinfo==9.0.0
Pygments==2.17.2
pytest==7.1.3
pytest-benchmark==4.0.0
rich==13.7.1
tomli==2.0.1
typing_extensions==4.10.0
wrapt==1.16.0
zipp==3.17.0
-e exporter/opentelemetry-exporter-richconsole
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.5",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-util-http == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"opentelemetry-semantic-conventions == 0.46b0.dev",
"opentelemetry-util-http == 0.46b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-util-http == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"opentelemetry-semantic-conventions == 0.46b0.dev",
"opentelemetry-util-http == 0.46b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-instrumentation-dbapi == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"opentelemetry-instrumentation-dbapi == 0.46b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ classifiers = [
dependencies = [
"asgiref ~= 3.0",
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-util-http == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"opentelemetry-semantic-conventions == 0.46b0.dev",
"opentelemetry-util-http == 0.46b0.dev",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def client_response_hook(span: Span, message: dict):
import urllib
from functools import wraps
from timeit import default_timer
from typing import Any, Awaitable, Callable, Tuple, cast
from typing import Any, Awaitable, Callable, Tuple

from asgiref.compatibility import guarantee_single_callable

Expand Down Expand Up @@ -347,11 +347,17 @@ def collect_custom_headers_attributes(
- https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-request-and-response-headers
"""
# Decode headers before processing.
headers: dict[str, str] = {
_key.decode("utf8"): _value.decode("utf8")
for (_key, _value) in scope_or_response_message.get("headers")
or cast("list[tuple[bytes, bytes]]", [])
}
headers: dict[str, str] = {}
raw_headers = scope_or_response_message.get("headers")
if raw_headers:
for _key, _value in raw_headers:
key = _key.decode().lower()
value = _value.decode()
if key in headers:
headers[key] += f",{value}"
else:
headers[key] = value

return sanitize.sanitize_header_values(
headers,
header_regexes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.45b0.dev"
__version__ = "0.46b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ async def http_app_with_custom_headers(scope, receive, send):
await send({"type": "http.response.body", "body": b"*"})


async def http_app_with_repeat_headers(scope, receive, send):
message = await receive()
assert scope["type"] == "http"
if message.get("type") == "http.request":
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [
(b"Content-Type", b"text/plain"),
(b"custom-test-header-1", b"test-header-value-1"),
(b"custom-test-header-1", b"test-header-value-2"),
],
}
)
await send({"type": "http.response.body", "body": b"*"})


async def websocket_app_with_custom_headers(scope, receive, send):
assert scope["type"] == "websocket"
while True:
Expand Down Expand Up @@ -121,6 +139,25 @@ def test_http_custom_request_headers_in_span_attributes(self):
if span.kind == SpanKind.SERVER:
self.assertSpanHasAttributes(span, expected)

def test_http_repeat_request_headers_in_span_attributes(self):
self.scope["headers"].extend(
[
(b"custom-test-header-1", b"test-header-value-1"),
(b"custom-test-header-1", b"test-header-value-2"),
]
)
self.seed_app(self.app)
self.send_default_request()
self.get_all_output()
span_list = self.exporter.get_finished_spans()
expected = {
"http.request.header.custom_test_header_1": (
"test-header-value-1,test-header-value-2",
),
}
span = next(span for span in span_list if span.kind == SpanKind.SERVER)
self.assertSpanHasAttributes(span, expected)

def test_http_custom_request_headers_not_in_span_attributes(self):
self.scope["headers"].extend(
[
Expand Down Expand Up @@ -176,6 +213,24 @@ def test_http_custom_response_headers_in_span_attributes(self):
if span.kind == SpanKind.SERVER:
self.assertSpanHasAttributes(span, expected)

def test_http_repeat_response_headers_in_span_attributes(self):
self.app = otel_asgi.OpenTelemetryMiddleware(
http_app_with_repeat_headers,
tracer_provider=self.tracer_provider,
**self.constructor_params,
)
self.seed_app(self.app)
self.send_default_request()
self.get_all_output()
span_list = self.exporter.get_finished_spans()
expected = {
"http.response.header.custom_test_header_1": (
"test-header-value-1,test-header-value-2",
),
}
span = next(span for span in span_list if span.kind == SpanKind.SERVER)
self.assertSpanHasAttributes(span, expected)

def test_http_custom_response_headers_not_in_span_attributes(self):
self.app = otel_asgi.OpenTelemetryMiddleware(
http_app_with_custom_headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.14",
"opentelemetry-instrumentation == 0.45b0.dev",
"opentelemetry-semantic-conventions == 0.45b0.dev",
"opentelemetry-test-utils == 0.45b0.dev",
"opentelemetry-instrumentation == 0.46b0.dev",
"opentelemetry-semantic-conventions == 0.46b0.dev",
"opentelemetry-test-utils == 0.46b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Loading

0 comments on commit d9762cb

Please sign in to comment.