Skip to content

Commit 3c58d85

Browse files
committed
2 parents 9d5c43e + fc8a02b commit 3c58d85

File tree

19 files changed

+123
-40
lines changed

19 files changed

+123
-40
lines changed

.github/CODEOWNERS

+21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Code owners file.
22
# This file controls who is tagged for review for any given pull request.
3+
#
4+
# What is a "CODEOWNER"?
5+
#
6+
# A CODEOWNER lends their expertise to a specific package hosted by an OpenTelemetry repository.
7+
#
8+
# A CODEOWNER MUST:
9+
# - introduce themselves on the CNCF OTel Python channel: https://cloud-native.slack.com/archives/C01PD4HUVBL
10+
# - have enough knowledge of the corresponding instrumented library
11+
# - respond to issues
12+
# - fix failing unit tests or any other blockers to the CI/CD workflow
13+
# - update usage of `opentelemetry-python-core` APIs upon the introduction of breaking changes
14+
# - be a member of the OpenTelemetry community so that the `component-owners.yml` action to automatically assign CODEOWNERS to PRs works correctly.
15+
#
16+
317

418
# For anything not explicitly taken by someone else:
519
* @open-telemetry/opentelemetry-python-contrib-approvers
20+
21+
# Learn about CODEOWNERS file format:
22+
# https://help.github.com/en/articles/about-code-owners
23+
#
24+
# Learn about membership in OpenTelemetry community:
25+
# https://github.com/open-telemetry/community/blob/main/community-membership.md
26+
#

.github/component_owners.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
components:
2+
3+
sdk-extension/opentelemetry-sdk-extension-aws:
4+
- NathanielRN
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This action assigns and requires approval from owners of components for
2+
# PRs that are open against those components. Components are defined as
3+
# individual paths within this repository.
4+
name: 'Component Owners'
5+
6+
on:
7+
pull_request_target:
8+
9+
jobs:
10+
run_self:
11+
runs-on: ubuntu-latest
12+
name: Auto Assign Owners
13+
# Don't fail tests if this workflow fails. Some pending issues:
14+
# - https://github.com/dyladan/component-owners/issues/8
15+
continue-on-error: true
16+
steps:
17+
- uses: dyladan/component-owners@main

CHANGELOG.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.5.0-0.24b0...HEAD)
9+
- `opentelemetry-sdk-extension-aws` Release AWS Python SDK Extension as 1.0.0
10+
([#667](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/667))
11+
12+
### Changed
13+
- `opentelemetry-instrumentation-botocore` Unpatch botocore Endpoint.prepare_request on uninstrument
14+
([#664](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/664))
15+
- `opentelemetry-instrumentation-botocore` Fix span injection for lambda invoke
16+
([#663](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/663))
917

1018
## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26
1119

@@ -20,8 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2028

2129
- `opentelemetry-instrumentation-fastapi` Allow instrumentation of newer FastAPI versions.
2230
([#602](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/602))
23-
24-
### Changed
2531
- Enable explicit `excluded_urls` argument in `opentelemetry-instrumentation-flask`
2632
([#604](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/604))
2733

CODEOWNERS

-13
This file was deleted.

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ install](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs)
6666
pip install -e ./instrumentation/opentelemetry-instrumentation-{integration}
6767
```
6868

69+
## Releasing
70+
71+
Maintainers aim to periodically release new versions of the packages in `opentelemetry-python-contrib`.
72+
73+
Contributions that enhance OTel for Python are welcome to be hosted upstream for the benefit of group collaboration. Maintainers will look for things like good documentation, good unit tests, and in general their own confidence when deciding to release a package with the stability guarantees that are implied with a `1.0` release.
74+
75+
To resolve this, members of the community are encouraged to commit to becoming a CODEOWNER for packages in `-contrib` that they feel experienced enough to maintain. CODEOWNERS can then follow the checklist below to release `-contrib` packages as 1.0 stable:
76+
77+
### Releasing a package as `1.0` stable
78+
79+
To release a package as `1.0` stable, the package:
80+
- SHOULD have a CODEOWNER. To become one, submit an issue and explain why you meet the responsibilities found in [CODEOWNERS](.github/CODEOWNERS).
81+
- MUST have unit tests that cover all supported versions of the instrumented library.
82+
- e.g. Instrumentation packages might use different techniques to instrument different major versions of python packages
83+
- MUST have clear documentation for non-obvious usages of the package
84+
- e.g. If an instrumentation package uses flags, a token as context, or parameters that are not typical of the `BaseInstrumentor` class, these are documented
85+
- After the release of `1.0`, a CODEOWNER may no longer feel like they have the bandwidth to meet the responsibilities of maintaining the package. That's not a problem at all, life happens! However, if that is the case, we ask that the CODEOWNER please raise an issue indicating that they would like to be removed as a CODEOWNER so that they don't get pinged on future PRs. Ultimately, we hope to use that issue to find a new CODEOWNER.
86+
6987
## Contributing
7088

7189
See [CONTRIBUTING.md](CONTRIBUTING.md)

instrumentation/opentelemetry-instrumentation-aiopg/setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ package_dir=
3939
packages=find_namespace:
4040
install_requires =
4141
opentelemetry-api ~= 1.3
42-
opentelemetry-semantic-conventions == 0.24b0
4342
opentelemetry-instrumentation-dbapi == 0.24b0
4443
opentelemetry-instrumentation == 0.24b0
4544
wrapt >= 1.0.0, < 2.0.0
4645

4746
[options.extras_require]
4847
test =
4948
opentelemetry-test == 0.24b0
49+
opentelemetry-semantic-conventions == 0.24b0
5050

5151
[options.packages.find]
5252
where = src

instrumentation/opentelemetry-instrumentation-boto/setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ install_requires =
4141
opentelemetry-api ~= 1.3
4242
opentelemetry-semantic-conventions == 0.24b0
4343
opentelemetry-instrumentation == 0.24b0
44-
opentelemetry-instrumentation-botocore == 0.24b0
4544

4645
[options.extras_require]
4746
test =

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from typing import Collection
5252

5353
from botocore.client import BaseClient
54+
from botocore.endpoint import Endpoint
5455
from botocore.exceptions import ClientError
5556
from wrapt import wrap_function_wrapper
5657

@@ -114,6 +115,7 @@ def _instrument(self, **kwargs):
114115

115116
def _uninstrument(self, **kwargs):
116117
unwrap(BaseClient, "_make_api_call")
118+
unwrap(Endpoint, "prepare_request")
117119

118120
@staticmethod
119121
def _is_lambda_invoke(service_name, operation_name, api_params):
@@ -148,15 +150,15 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
148150
error = None
149151
result = None
150152

151-
# inject trace context into payload headers for lambda Invoke
152-
if BotocoreInstrumentor._is_lambda_invoke(
153-
service_name, operation_name, api_params
154-
):
155-
BotocoreInstrumentor._patch_lambda_invoke(api_params)
156-
157153
with self._tracer.start_as_current_span(
158154
"{}".format(service_name), kind=SpanKind.CLIENT,
159155
) as span:
156+
# inject trace context into payload headers for lambda Invoke
157+
if BotocoreInstrumentor._is_lambda_invoke(
158+
service_name, operation_name, api_params
159+
):
160+
BotocoreInstrumentor._patch_lambda_invoke(api_params)
161+
160162
if span.is_recording():
161163
span.set_attribute("aws.operation", operation_name)
162164
span.set_attribute("aws.region", instance.meta.region_name)

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def lambda_handler(event, context):
6161
return pfunc
6262

6363

64+
# pylint:disable=too-many-public-methods
6465
class TestBotocoreInstrumentor(TestBase):
6566
"""Botocore integration testsuite"""
6667

@@ -322,6 +323,31 @@ def test_unpatch(self):
322323
spans = self.memory_exporter.get_finished_spans()
323324
assert not spans, spans
324325

326+
@mock_ec2
327+
def test_uninstrument_does_not_inject_headers(self):
328+
headers = {}
329+
previous_propagator = get_global_textmap()
330+
try:
331+
set_global_textmap(MockTextMapPropagator())
332+
333+
def intercept_headers(**kwargs):
334+
headers.update(kwargs["request"].headers)
335+
336+
ec2 = self.session.create_client("ec2", region_name="us-west-2")
337+
338+
BotocoreInstrumentor().uninstrument()
339+
340+
ec2.meta.events.register_first(
341+
"before-send.ec2.DescribeInstances", intercept_headers
342+
)
343+
with self.tracer_provider.get_tracer("test").start_span("parent"):
344+
ec2.describe_instances()
345+
346+
self.assertNotIn(MockTextMapPropagator.TRACE_ID_KEY, headers)
347+
self.assertNotIn(MockTextMapPropagator.SPAN_ID_KEY, headers)
348+
finally:
349+
set_global_textmap(previous_propagator)
350+
325351
@mock_sqs
326352
def test_double_patch(self):
327353
sqs = self.session.create_client("sqs", region_name="us-east-1")
@@ -409,11 +435,13 @@ def test_lambda_invoke_propagation(self):
409435

410436
self.assertIn(MockTextMapPropagator.TRACE_ID_KEY, headers)
411437
self.assertEqual(
412-
"0", headers[MockTextMapPropagator.TRACE_ID_KEY],
438+
str(spans[2].get_span_context().trace_id),
439+
headers[MockTextMapPropagator.TRACE_ID_KEY],
413440
)
414441
self.assertIn(MockTextMapPropagator.SPAN_ID_KEY, headers)
415442
self.assertEqual(
416-
"0", headers[MockTextMapPropagator.SPAN_ID_KEY],
443+
str(spans[2].get_span_context().span_id),
444+
headers[MockTextMapPropagator.SPAN_ID_KEY],
417445
)
418446
finally:
419447
set_global_textmap(previous_propagator)

instrumentation/opentelemetry-instrumentation-httpx/setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ install_requires =
4242
opentelemetry-api ~= 1.3
4343
opentelemetry-instrumentation == 0.24b0
4444
opentelemetry-semantic-conventions == 0.24b0
45-
wrapt >= 1.0.0, < 2.0.0
4645

4746
[options.extras_require]
4847
test =

instrumentation/opentelemetry-instrumentation-mysql/setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ install_requires =
4141
opentelemetry-api ~= 1.3
4242
opentelemetry-instrumentation-dbapi == 0.24b0
4343
opentelemetry-instrumentation == 0.24b0
44-
wrapt >= 1.0.0, < 2.0.0
4544

4645
[options.extras_require]
4746
test =

instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
cnx = mysql.connector.connect(database="MySQL_Database")
3232
cursor = cnx.cursor()
33-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
33+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
3434
cursor.close()
3535
cnx.close()
3636

instrumentation/opentelemetry-instrumentation-psycopg2/setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ install_requires =
4141
opentelemetry-api ~= 1.3
4242
opentelemetry-instrumentation-dbapi == 0.24b0
4343
opentelemetry-instrumentation == 0.24b0
44-
wrapt >= 1.0.0, < 2.0.0
4544

4645
[options.extras_require]
4746
test =

instrumentation/opentelemetry-instrumentation-sqlite3/setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ install_requires =
4141
opentelemetry-api ~= 1.3
4242
opentelemetry-instrumentation-dbapi == 0.24b0
4343
opentelemetry-instrumentation == 0.24b0
44-
wrapt >= 1.0.0, < 2.0.0
4544

4645
[options.extras_require]
4746
test =

sdk-extension/opentelemetry-sdk-extension-aws/README.rst

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ Next, use the provided `AwsXRayIdGenerator` to initialize the `TracerProvider`.
4646
Usage (AWS X-Ray Propagator)
4747
----------------------------
4848

49+
**NOTE**: Because the parent context extracted from the `X-Amzn-Trace-Id` header
50+
assumes the context is _not_ sampled by default, users should make sure to add
51+
`Sampled=1` to their `X-Amzn-Trace-Id` headers so that the child spans are
52+
sampled.
53+
4954
Use the provided AWS X-Ray Propagator to inject the necessary context into
5055
traces sent to external systems.
5156

sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/trace/propagation/aws_xray_format.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@
1818
1919
The **AWS X-Ray Propagator** provides a propagator that when used, adds a `trace
2020
header`_ to outgoing traces that is compatible with the AWS X-Ray backend service.
21-
This allows the trace context to be propagated when a trace span multiple AWS
21+
This allows the trace context to be propagated when a trace spans multiple AWS
2222
services.
2323
24+
The same propagator setup is used to extract a context sent by external systems
25+
so that child span have the correct parent context.
26+
27+
**NOTE**: Because the parent context parsed from the ``X-Amzn-Trace-Id`` header
28+
assumes the context is _not_ sampled by default, users should make sure to add
29+
``Sampled=1`` to their ``X-Amzn-Trace-Id`` headers so that the child spans are
30+
sampled.
31+
2432
Usage
2533
-----
2634

sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py

+1-1
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.24b0"
15+
__version__ = "1.0.0"

util/opentelemetry-util-http/setup.cfg

-8
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ python_requires = >=3.6
3737
package_dir=
3838
=src
3939
packages=find_namespace:
40-
install_requires =
41-
opentelemetry-api ~= 1.3
42-
opentelemetry-instrumentation == 0.24b0
43-
asgiref ~= 3.0
44-
45-
[options.extras_require]
46-
test =
47-
opentelemetry-test == 0.24b0
4840

4941
[options.packages.find]
5042
where = src

0 commit comments

Comments
 (0)