Skip to content

Commit 54ed39e

Browse files
authored
Merge branch 'main' into feature/remove-version-flask-alias
2 parents a7dc20b + 3273d8c commit 54ed39e

File tree

7 files changed

+63
-41
lines changed

7 files changed

+63
-41
lines changed

CONTRIBUTING.md

+37-20
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,26 @@ on how to become a [**Member**](https://github.com/open-telemetry/community/blob
1313
[**Approver**](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
1414
and [**Maintainer**](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).
1515

16-
## Find a Buddy and get Started Quickly!
16+
## Index
17+
18+
* [Find a Buddy and get Started Quickly](#find-a-buddy-and-get-started-quickly)
19+
* [Development](#development)
20+
* [Troubleshooting](#troubleshooting)
21+
* [Benchmarks](#benchmarks)
22+
* [Pull requests](#pull-requests)
23+
* [How to Send Pull Requests](#how-to-send-pull-requests)
24+
* [How to Receive Comments](#how-to-receive-comments)
25+
* [How to Get PRs Reviewed](#how-to-get-prs-reviewed)
26+
* [How to Get PRs Merged](#how-to-get-prs-merged)
27+
* [Design Choices](#design-choices)
28+
* [Focus on Capabilities, Not Structure Compliance](#focus-on-capabilities-not-structure-compliance)
29+
* [Running Tests Locally](#running-tests-locally)
30+
* [Testing against a different Core repo branch/commit](#testing-against-a-different-core-repo-branchcommit)
31+
* [Style Guide](#style-guide)
32+
* [Guideline for instrumentations](#guideline-for-instrumentations)
33+
* [Expectations from contributors](#expectations-from-contributors)
34+
35+
## Find a Buddy and get Started Quickly
1736

1837
If you are looking for someone to help you find a starting point and be a resource for your first contribution, join our
1938
Slack and find a buddy!
@@ -31,8 +50,8 @@ This project uses [tox](https://tox.readthedocs.io) to automate
3150
some aspects of development, including testing against multiple Python versions.
3251
To install `tox`, run:
3352

34-
```console
35-
$ pip install tox
53+
```sh
54+
pip install tox
3655
```
3756

3857
You can run `tox` with the following arguments:
@@ -57,7 +76,7 @@ for more detail on available tox commands.
5776

5877
### Troubleshooting
5978

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.
79+
> 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.
6180
6281
### Benchmarks
6382

@@ -94,13 +113,13 @@ pull requests (PRs).
94113
To create a new PR, fork the project in GitHub and clone the upstream repo:
95114

96115
```sh
97-
$ git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git
116+
git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git
98117
```
99118

100119
Add your fork as an origin:
101120

102121
```sh
103-
$ git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git
122+
git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git
104123
```
105124

106125
Run tests:
@@ -114,10 +133,10 @@ $ tox # execute in the root of the repository
114133
Check out a new branch, make modifications and push the branch to your fork:
115134

116135
```sh
117-
$ git checkout -b feature
136+
git checkout -b feature
118137
# edit files
119-
$ git commit
120-
$ git push fork feature
138+
git commit
139+
git push fork feature
121140
```
122141

123142
Open a pull request against the main `opentelemetry-python-contrib` repo.
@@ -142,6 +161,7 @@ If you are not getting reviews, please contact the respective owners directly.
142161
### How to Get PRs Merged
143162

144163
A PR is considered to be **ready to merge** when:
164+
145165
* It has received two approvals from [Approvers](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
146166
/ [Maintainers](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer)
147167
(at different companies).
@@ -186,8 +206,7 @@ Some of the tox targets install packages from the [OpenTelemetry Python Core Rep
186206

187207
CORE_REPO_SHA=c49ad57bfe35cfc69bfa863d74058ca9bec55fc3 tox
188208

189-
The continuation integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/test.yml#L9).
190-
209+
The continuation integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/.github/workflows/test.yml#L9).
191210

192211
## Style Guide
193212

@@ -203,27 +222,25 @@ Below is a checklist of things to be mindful of when implementing a new instrume
203222

204223
- Follow semantic conventions
205224
- The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/semantic-conventions.md)
206-
- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L26)
225+
- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L35)
207226
- Supports auto-instrumentation
208-
- Add an entry point (ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/f045c43affff6ff1af8fa2f7514a4fdaca97dacf/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44)
227+
- Add an entry point (ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44>)
209228
- Run `python scripts/generate_instrumentation_bootstrap.py` after adding a new instrumentation package.
210229
- Functionality that is common amongst other instrumentation and can be abstracted [here](https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation)
211230
- Request/response [hooks](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/408) for http instrumentations
212231
- `suppress_instrumentation` functionality
213-
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/3ec77360cb20482b08b30312a6bedc8b946e3fa1/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L111
232+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py#L191>
214233
- Suppress propagation functionality
215234
- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/344 for more context
216235
- `exclude_urls` functionality
217-
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L91
236+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L327>
218237
- `url_filter` functionality
219-
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L235
238+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L268>
220239
- `is_recording()` optimization on non-sampled spans
221-
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L133
240+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L234>
222241
- Appropriate error handling
223-
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L146
224-
242+
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L220>
225243

226244
## Expectations from contributors
227245

228246
OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.
229-

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,20 @@
3636

3737
---
3838

39-
## OpenTelemetry Python Contrib
39+
# OpenTelemetry Python Contrib
4040

4141
The Python auto-instrumentation libraries for [OpenTelemetry](https://opentelemetry.io/) (per [OTEP 0001](https://github.com/open-telemetry/oteps/blob/main/text/0001-telemetry-without-manual-instrumentation.md))
4242

43-
### Installation
43+
## Index
44+
45+
* [Installation](#installation)
46+
* [Releasing](#releasing)
47+
* [Releasing a package as `1.0` stable](#releasing-a-package-as-10-stable)
48+
* [Contributing](#contributing)
49+
* [Running Tests Locally](#running-tests-locally)
50+
* [Thanks to all the people who already contributed](#thanks-to-all-the-people-who-already-contributed)
51+
52+
## Installation
4453

4554
This repository includes installable packages for each instrumented library. Libraries that produce telemetry data should only depend on `opentelemetry-api`,
4655
and defer the choice of the SDK to the application developer. Applications may
@@ -79,6 +88,7 @@ To resolve this, members of the community are encouraged to commit to becoming a
7988
### Releasing a package as `1.0` stable
8089

8190
To release a package as `1.0` stable, the package:
91+
8292
- SHOULD have a CODEOWNER. To become one, submit an issue and explain why you meet the responsibilities found in [CODEOWNERS](.github/CODEOWNERS).
8393
- MUST have unit tests that cover all supported versions of the instrumented library.
8494
- e.g. Instrumentation packages might use different techniques to instrument different major versions of python packages
@@ -131,9 +141,8 @@ Emeritus Maintainers:
131141
4. Make sure you have `tox` installed. `pip install tox`.
132142
5. Run tests for a package. (e.g. `tox -e test-instrumentation-flask`.)
133143

134-
### Thanks to all the people who already contributed!
144+
### Thanks to all the people who already contributed
135145

136146
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/graphs/contributors">
137147
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-python-contrib" />
138148
</a>
139-

RELEASING.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@
7777
* If for some reason the action failed, see [Publish failed](#publish-failed) below
7878
* Move stable tag
7979
* Run the following (TODO automate):
80+
8081
```bash
8182
git tag -d stable
8283
git tag stable
8384
git push --delete origin tagname
8485
git push origin stable
8586
```
87+
8688
* This will ensure the docs are pointing at the stable release.
8789
* To validate this worked, ensure the stable build has run successfully:
88-
https://readthedocs.org/projects/opentelemetry-python/builds/.
90+
<https://readthedocs.org/projects/opentelemetry-python/builds/>.
8991
If the build has not run automatically, it can be manually trigger via the readthedocs interface.
9092

9193
## Troubleshooting
@@ -98,4 +100,4 @@ If for some reason the action failed, do it manually:
98100
- Build distributions with `./scripts/build.sh`
99101
- Delete distributions we don't want to push (e.g. `testutil`)
100102
- Push to PyPI as `twine upload --skip-existing --verbose dist/*`
101-
- Double check PyPI!
103+
- Double check PyPI!

exporter/opentelemetry-exporter-prometheus-remote-write/proto/generate-proto-py.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -e
23

34
PROM_VERSION=v2.39.0
45
PROTO_VERSION=v1.3.2

instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def _test_publish(self, exchange_type: Type[Exchange]):
7575
with mock.patch.object(
7676
PublishDecorator, "_get_publish_span"
7777
) as mock_get_publish_span:
78-
with mock.patch.object(
79-
Exchange, "publish", return_value=asyncio.sleep(0)
80-
) as mock_publish:
78+
with mock.patch.object(Exchange, "publish") as mock_publish:
8179
decorated_publish = PublishDecorator(
8280
self.tracer, exchange
8381
).decorate(mock_publish)
@@ -101,9 +99,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type):
10199
mocked_not_recording_span = MagicMock()
102100
mocked_not_recording_span.is_recording.return_value = False
103101
mock_get_publish_span.return_value = mocked_not_recording_span
104-
with mock.patch.object(
105-
Exchange, "publish", return_value=asyncio.sleep(0)
106-
) as mock_publish:
102+
with mock.patch.object(Exchange, "publish") as mock_publish:
107103
with mock.patch(
108104
"opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject"
109105
) as mock_inject:
@@ -158,9 +154,7 @@ def _test_publish(self, exchange_type: Type[Exchange]):
158154
with mock.patch.object(
159155
PublishDecorator, "_get_publish_span"
160156
) as mock_get_publish_span:
161-
with mock.patch.object(
162-
Exchange, "publish", return_value=asyncio.sleep(0)
163-
) as mock_publish:
157+
with mock.patch.object(Exchange, "publish") as mock_publish:
164158
decorated_publish = PublishDecorator(
165159
self.tracer, exchange
166160
).decorate(mock_publish)
@@ -184,9 +178,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type):
184178
mocked_not_recording_span = MagicMock()
185179
mocked_not_recording_span.is_recording.return_value = False
186180
mock_get_publish_span.return_value = mocked_not_recording_span
187-
with mock.patch.object(
188-
Exchange, "publish", return_value=asyncio.sleep(0)
189-
) as mock_publish:
181+
with mock.patch.object(Exchange, "publish") as mock_publish:
190182
with mock.patch(
191183
"opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject"
192184
) as mock_inject:

instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_instrumentor_connect(self):
7676
cnx = async_call(aiopg.connect(database="test"))
7777
cursor = async_call(cnx.cursor())
7878
query = "SELECT * FROM test"
79-
cursor.execute(query)
79+
async_call(cursor.execute(query))
8080

8181
spans_list = self.memory_exporter.get_finished_spans()
8282
self.assertEqual(len(spans_list), 1)
@@ -127,7 +127,7 @@ def test_instrumentor_create_pool(self):
127127
cnx = async_call(pool.acquire())
128128
cursor = async_call(cnx.cursor())
129129
query = "SELECT * FROM test"
130-
cursor.execute(query)
130+
async_call(cursor.execute(query))
131131

132132
spans_list = self.memory_exporter.get_finished_spans()
133133
self.assertEqual(len(spans_list), 1)

scripts/prepare_release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
2-
#
2+
set -e
3+
34
# This script:
45
# 1. parses the version number from the branch name
56
# 2. updates version.py files to match that version

0 commit comments

Comments
 (0)