Skip to content

Commit 103c8c2

Browse files
Merge branch 'main' into fix-jinja2-template
2 parents 9beded8 + bfcb16b commit 103c8c2

File tree

30 files changed

+1153
-351
lines changed

30 files changed

+1153
-351
lines changed

.github/component_owners.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ components:
3535
sdk-extension/opentelemetry-sdk-extension-aws:
3636
- NathanielRN
3737
- Kausik-A
38+
- srprash
3839

3940
instrumentation/opentelemetry-instrumentation-tortoiseorm:
4041
- tonybaloney

.github/workflows/instrumentations_0.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: f31903a03721ce90c338be33131222d4cba37325
9+
CORE_REPO_SHA: main
1010

1111
jobs:
1212
instrumentations-0:

.github/workflows/instrumentations_1.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: f31903a03721ce90c338be33131222d4cba37325
9+
CORE_REPO_SHA: main
1010

1111
jobs:
1212
instrumentations-1:
@@ -39,6 +39,7 @@ jobs:
3939
- "resource-detector-container"
4040
- "util-http"
4141
- "fastapi-slim"
42+
- "processor-baggage"
4243
os: [ubuntu-20.04]
4344
exclude:
4445
- python-version: pypy3

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: f31903a03721ce90c338be33131222d4cba37325
9+
CORE_REPO_SHA: main
1010

1111
jobs:
1212
lint-3_12:

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: f31903a03721ce90c338be33131222d4cba37325
9+
CORE_REPO_SHA: main
1010

1111
jobs:
1212
misc:

CHANGELOG.md

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

88
## Unreleased
99

10+
## Fixed
11+
12+
- `opentelemetry-instrumentation-aws-lambda` Avoid exception when a handler is not present.
13+
([#2750](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2750))
14+
- `opentelemetry-instrumentation-django` Fix regression - `http.target` re-added back to old semconv duration metrics
15+
([#2746](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2746))
16+
- `opentelemetry-instrumentation-grpc` Fixes the issue with the gRPC instrumentation not working with the 1.63.0 and higher version of gRPC
17+
([#2483](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2484))
18+
1019
## Version 1.26.0/0.47b0 (2024-07-23)
1120

1221
### Added
@@ -47,6 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4756
([#2715](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2715))
4857
- `opentelemetry-instrumentation-django` Implement new semantic convention opt-in with stable http semantic conventions
4958
([#2714](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2714))
59+
- `opentelemetry-instrumentation-urllib` Implement new semantic convention opt-in migration
60+
([#2736](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2736))
5061

5162
### Breaking changes
5263

@@ -62,11 +73,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6273
([#2682](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682))
6374
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `django` middleware
6475
([#2714](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2714))
76+
- Populate `{method}` as `HTTP` on `_OTHER` methods from scope for `urllib` instrumentation
77+
([#2736](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2736))
6578
- `opentelemetry-instrumentation-httpx`, `opentelemetry-instrumentation-aiohttp-client`,
6679
`opentelemetry-instrumentation-requests` Populate `{method}` as `HTTP` on `_OTHER` methods
6780
([#2726](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2726))
6881
- `opentelemetry-instrumentation-fastapi` Add dependency support for fastapi-slim
6982
([#2702](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2702))
83+
- `opentelemetry-instrumentation-urllib3` improve request_hook, replacing `headers` and `body` parameters with a single `request_info: RequestInfo` parameter that now contains the `method` and `url` ([#2711](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2711))
7084

7185
### Fixed
7286

@@ -98,7 +112,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
98112
- `opentelemetry-instrumentation-asgi` Bugfix: Middleware did not set status code attribute on duration metrics for non-recording spans.
99113
([#2627](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2627))
100114

101-
102115
## Version 1.25.0/0.46b0 (2024-05-31)
103116

104117
### Breaking changes

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ The continuous integration overrides that environment variable with as per the c
250250
Below is a checklist of things to be mindful of when implementing a new instrumentation or working on a specific instrumentation. It is one of our goals as a community to keep the implementation specific details of instrumentations as similar across the board as possible for ease of testing and feature parity. It is also good to abstract as much common functionality as possible.
251251

252252
- Follow semantic conventions
253-
- The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/semantic-conventions.md)
253+
- The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/semantic-conventions/tree/main/docs)
254+
- Contains a name that is not already claimed in [Pypi](https://pypi.org/). Contact a maintainer, bring the issue up in the weekly Python SIG or create a ticket in Pypi if a desired name has already been taken.
254255
- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L35)
255256
- Supports auto-instrumentation
256257
- Add an entry point (ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44>)

RELEASING.md

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
<https://readthedocs.org/projects/opentelemetry-python/builds/>.
9191
If the build has not run automatically, it can be manually trigger via the readthedocs interface.
9292

93+
## Releasing dev version of new packages to claim namespace
94+
95+
When a contribution introduces a new package, in order to mitigate name-squatting incidents, release the current development version of the new package under the `opentelemetry` user to simply claim the namespace. This should be done shortly after the PR that introduced this package has been merged into `main`.
96+
9397
## Troubleshooting
9498

9599
### Publish failed

instrumentation/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
| [opentelemetry-instrumentation-threading](./opentelemetry-instrumentation-threading) | threading | No | experimental
4646
| [opentelemetry-instrumentation-tornado](./opentelemetry-instrumentation-tornado) | tornado >= 5.1.1 | Yes | experimental
4747
| [opentelemetry-instrumentation-tortoiseorm](./opentelemetry-instrumentation-tortoiseorm) | tortoise-orm >= 0.17.0 | No | experimental
48-
| [opentelemetry-instrumentation-urllib](./opentelemetry-instrumentation-urllib) | urllib | Yes | experimental
48+
| [opentelemetry-instrumentation-urllib](./opentelemetry-instrumentation-urllib) | urllib | Yes | migration
4949
| [opentelemetry-instrumentation-urllib3](./opentelemetry-instrumentation-urllib3) | urllib3 >= 1.0.0, < 3.0.0 | Yes | migration
5050
| [opentelemetry-instrumentation-wsgi](./opentelemetry-instrumentation-wsgi) | wsgi | Yes | migration

instrumentation/opentelemetry-instrumentation-asyncio/pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies = [
2828
"opentelemetry-api ~= 1.14",
2929
"opentelemetry-instrumentation == 0.48b0.dev",
3030
"opentelemetry-semantic-conventions == 0.48b0.dev",
31-
"opentelemetry-test-utils == 0.48b0.dev",
3231
"wrapt >= 1.0.0, < 2.0.0",
3332
]
3433

instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def _instrument(self, **kwargs):
410410
"""Instruments Lambda Handlers on AWS Lambda.
411411
412412
See more:
413-
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/instrumentation/aws-lambda.md#instrumenting-aws-lambda
413+
https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/aws-lambda.md
414414
415415
Args:
416416
**kwargs: Optional arguments
@@ -422,6 +422,14 @@ def _instrument(self, **kwargs):
422422
request.
423423
"""
424424
lambda_handler = os.environ.get(ORIG_HANDLER, os.environ.get(_HANDLER))
425+
if not lambda_handler:
426+
logger.warning(
427+
(
428+
"Could not find the ORIG_HANDLER or _HANDLER in the environment variables. ",
429+
"This instrumentation requires the OpenTelemetry Lambda extension installed.",
430+
)
431+
)
432+
return
425433
# pylint: disable=attribute-defined-outside-init
426434
(
427435
self._wrapped_module_name,

instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py

+14
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,20 @@ def test_lambda_handles_handler_exception_with_api_gateway_proxy_event(
495495

496496
exc_env_patch.stop()
497497

498+
def test_lambda_handles_should_do_nothing_when_environment_variables_not_present(
499+
self,
500+
):
501+
exc_env_patch = mock.patch.dict(
502+
"os.environ",
503+
{_HANDLER: ""},
504+
)
505+
exc_env_patch.start()
506+
AwsLambdaInstrumentor().instrument()
507+
508+
spans = self.memory_exporter.get_finished_spans()
509+
self.assertEqual(len(spans), 0)
510+
exc_env_patch.stop()
511+
498512
def test_uninstrument(self):
499513
AwsLambdaInstrumentor().instrument()
500514

instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py

+5
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def process_exception(self, request, exception):
333333

334334
# pylint: disable=too-many-branches
335335
# pylint: disable=too-many-locals
336+
# pylint: disable=too-many-statements
336337
def process_response(self, request, response):
337338
if self._excluded_urls.url_disabled(request.build_absolute_uri("?")):
338339
return response
@@ -426,6 +427,10 @@ def process_response(self, request, response):
426427
duration_attrs_old = _parse_duration_attrs(
427428
duration_attrs, _HTTPStabilityMode.DEFAULT
428429
)
430+
# http.target to be included in old semantic conventions
431+
target = duration_attrs.get(SpanAttributes.HTTP_TARGET)
432+
if target:
433+
duration_attrs_old[SpanAttributes.HTTP_TARGET] = target
429434
self._duration_histogram_old.record(
430435
max(round(duration_s * 1000), 0), duration_attrs_old
431436
)

0 commit comments

Comments
 (0)