Skip to content

Commit ea77939

Browse files
authored
Merge branch 'main' into cherrypy-instrumentation
2 parents 74d771e + 868049e commit ea77939

File tree

163 files changed

+5377
-605
lines changed

Some content is hidden

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

163 files changed

+5377
-605
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ exclude =
1616
target
1717
__pycache__
1818
exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/gen/
19+
exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/
1920
exporter/opentelemetry-exporter-jaeger/build/*
2021
docs/examples/opentelemetry-example-app/src/opentelemetry_example_app/grpc/gen/
2122
docs/examples/opentelemetry-example-app/build/*

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: 321f90f96b80dc8118d58cc639e26a950418d138
9+
CORE_REPO_SHA: a97b3a70e852f77c6a25c69192fc506c127cdaaa
1010

1111
jobs:
1212
build:
@@ -16,13 +16,14 @@ jobs:
1616
py38: 3.8
1717
py39: 3.9
1818
py310: "3.10"
19+
py311: "3.11"
1920
pypy3: "pypy3.7"
2021
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
2122
runs-on: ${{ matrix.os }}
2223
strategy:
2324
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
2425
matrix:
25-
python-version: [ py37, py38, py39, py310, pypy3 ]
26+
python-version: [ py37, py38, py39, py310, py311, pypy3 ]
2627
package: ["instrumentation", "distro", "exporter", "sdkextension", "propagator"]
2728
os: [ ubuntu-20.04 ]
2829
steps:

CHANGELOG.md

Lines changed: 86 additions & 40 deletions
Large diffs are not rendered by default.

RELEASING.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Releasing OpenTelemetry Packages (for maintainers only)
2+
This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.
3+
4+
Release Process:
5+
* [Checkout a clean repo](#checkout-a-clean-repo)
6+
* [Update versions](#update-versions)
7+
* [Create a new branch](#create-a-new-branch)
8+
* [Open a Pull Request](#open-a-pull-request)
9+
* [Create a Release](#Create-a-Release)
10+
* [Move stable tag](#Move-stable-tag)
11+
* [Update main](#Update-main)
12+
* [Check PyPI](#Check-PyPI)
13+
* [Troubleshooting](#troubleshooting)
14+
15+
## Checkout a clean repo
16+
To avoid pushing untracked changes, check out the repo in a new dir
17+
18+
## Update versions
19+
The update of the version information relies on the information in eachdist.ini to identify which packages are stable, prerelease or
20+
experimental. Update the desired version there to begin the release process.
21+
22+
## Create a new branch
23+
The following script does the following:
24+
- update main locally
25+
- creates a new release branch `release/<version>`
26+
- updates version and changelog files
27+
- commits the change
28+
29+
*NOTE: This script was run by a GitHub Action but required the Action bot to be excluded from the CLA check, which it currently is not.*
30+
31+
```bash
32+
./scripts/prepare_release.sh
33+
```
34+
35+
## Open a Pull Request
36+
37+
The PR should be opened from the `release/<version>` branch created as part of running `prepare_release.sh` in the steps above.
38+
39+
## Create a Release
40+
41+
- Create the GH release from the main branch, using a new tag for this micro version, e.g. `v0.7.0`
42+
- Copy the changelogs from all packages that changed into the release notes (and reformat to remove hard line wraps)
43+
44+
45+
## Check PyPI
46+
47+
This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python/blob/main/.github/workflows/publish.yml).
48+
49+
- Check the [action logs](https://github.com/open-telemetry/opentelemetry-python/actions?query=workflow%3APublish) to make sure packages have been uploaded to PyPI
50+
- Check the release history (e.g. https://pypi.org/project/opentelemetry-api/#history) on PyPI
51+
52+
If for some reason the action failed, see [Publish failed](#publish-failed) below
53+
54+
## Move stable tag
55+
56+
This will ensure the docs are pointing at the stable release.
57+
58+
```bash
59+
git tag -d stable
60+
git tag stable
61+
git push --delete origin tagname
62+
git push origin stable
63+
```
64+
65+
To validate this worked, ensure the stable build has run successfully: https://readthedocs.org/projects/opentelemetry-python/builds/. If the build has not run automatically, it can be manually trigger via the readthedocs interface.
66+
67+
## Update main
68+
69+
Ensure the version and changelog updates have been applied to main. Update the versions in eachdist.ini once again this time to include the `.dev0` tag and
70+
run eachdist once again:
71+
```bash
72+
./scripts/eachdist.py update_versions --versions stable,prerelease
73+
```
74+
75+
If the diff includes significant changes, create a pull request to commit the changes and once the changes are merged, click the "Run workflow" button for the Update [OpenTelemetry Website Docs](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/docs-update.yml) GitHub Action.
76+
77+
## Hotfix procedure
78+
79+
A `hotfix` is defined as a small change developed to correct a bug that should be released as quickly as possible. Due to the nature of hotfixes, they usually will only affect one or a few packages. Therefore, it usually is not necessary to go through the entire release process outlined above for hotfixes. Follow the below steps how to release a hotfix:
80+
81+
1. Identify the packages that are affected by the bug. Make the changes to those packages, merging to `main`, as quickly as possible.
82+
2. On your local machine, remove the `dev0` tags from the version number and increment the patch version number.
83+
3. On your local machine, update `CHANGELOG.md` with the date of the hotfix change.
84+
4. With administrator privileges for PyPi, manually publish the affected packages.
85+
a. Install [twine](https://pypi.org/project/twine/)
86+
b. Navigate to where the `setup.py` file exists for the package you want to publish.
87+
c. Run `python setup.py sdist bdist_wheel`. You may have to install [wheel](https://pypi.org/project/wheel/) as well.
88+
d. Validate your built distributions by running `twine check dist/*`.
89+
e. Upload distributions to PyPi by running `twine upload dist/*`.
90+
5. Note that since hotfixes are manually published, the build scripts for publish after creating a release are not run.
91+
92+
## Troubleshooting
93+
94+
### Publish failed
95+
96+
If for some reason the action failed, do it manually:
97+
98+
- Switch to the release branch (important so we don't publish packages with "dev" versions)
99+
- Build distributions with `./scripts/build.sh`
100+
- Delete distributions we don't want to push (e.g. `testutil`)
101+
- Push to PyPI as `twine upload --skip-existing --verbose dist/*`
102+
- Double check PyPI!

_template/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3.8",
2727
"Programming Language :: Python :: 3.9",
2828
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
2930
]
3031
dependencies = [
3132
"opentelemetry-api ~= 1.12",

_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.34b0"
15+
__version__ = "0.36b0.dev"

eachdist.ini

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

1818
[stable]
19-
version=1.13.0
19+
version=1.15.0.dev
2020

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

3636
[prerelease]
37-
version=0.34b0
37+
version=0.36b0.dev
3838

3939
packages=
4040
all
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
OpenTelemetry Prometheus Remote Write Exporter
2+
==============================================
3+
4+
|pypi|
5+
6+
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-prometheus-remote-write.svg
7+
:target: https://pypi.org/project/opentelemetry-exporter-prometheus-remote-write/
8+
9+
This package contains an exporter to send metrics from the OpenTelemetry Python SDK directly to a Prometheus Remote Write integrated backend
10+
(such as Cortex or Thanos) without having to run an instance of the Prometheus server.
11+
12+
13+
Installation
14+
------------
15+
16+
::
17+
18+
pip install opentelemetry-exporter-prometheus-remote-write
19+
20+
21+
.. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/
22+
.. _Prometheus Remote Write integrated backend: https://prometheus.io/docs/operating/integrations/
23+
24+
25+
References
26+
----------
27+
28+
* `OpenTelemetry Project <https://opentelemetry.io/>`_
29+
* `Prometheus Remote Write Integration <https://prometheus.io/docs/operating/integrations/>`_
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.8
2+
3+
RUN apt-get update -y && apt-get install libsnappy-dev -y
4+
5+
WORKDIR /code
6+
COPY . .
7+
8+
RUN pip install -e .
9+
RUN pip install -r ./examples/requirements.txt
10+
11+
CMD ["python", "./examples/sampleapp.py"]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Prometheus Remote Write Exporter Example
2+
This example uses [Docker Compose](https://docs.docker.com/compose/) to set up:
3+
4+
1. A Python program that creates 5 instruments with 5 unique
5+
aggregators and a randomized load generator
6+
2. An instance of [Cortex](https://cortexmetrics.io/) to receive the metrics
7+
data
8+
3. An instance of [Grafana](https://grafana.com/) to visualizse the exported
9+
data
10+
11+
## Requirements
12+
* Have Docker Compose [installed](https://docs.docker.com/compose/install/)
13+
14+
*Users do not need to install Python as the app will be run in the Docker Container*
15+
16+
## Instructions
17+
1. Run `docker-compose up -d` in the the `examples/` directory
18+
19+
The `-d` flag causes all services to run in detached mode and frees up your
20+
terminal session. This also causes no logs to show up. Users can attach themselves to the service's logs manually using `docker logs ${CONTAINER_ID} --follow`
21+
22+
2. Log into the Grafana instance at [http://localhost:3000](http://localhost:3000)
23+
* login credentials are `username: admin` and `password: admin`
24+
* There may be an additional screen on setting a new password. This can be skipped and is optional
25+
26+
3. Navigate to the `Data Sources` page
27+
* Look for a gear icon on the left sidebar and select `Data Sources`
28+
29+
4. Add a new Prometheus Data Source
30+
* Use `http://cortex:9009/api/prom` as the URL
31+
* (OPTIONAl) set the scrape interval to `2s` to make updates appear quickly
32+
* click `Save & Test`
33+
34+
5. Go to `Metrics Explore` to query metrics
35+
* Look for a compass icon on the left sidebar
36+
* click `Metrics` for a dropdown list of all the available metrics
37+
* (OPTIONAL) Adjust time range by clicking the `Last 6 hours` button on the upper right side of the graph
38+
* (OPTIONAL) Set up auto-refresh by selecting an option under the dropdown next to the refresh button on the upper right side of the graph
39+
* Click the refresh button and data should show up on the graph
40+
41+
6. Shutdown the services when finished
42+
* Run `docker-compose down` in the examples directory

0 commit comments

Comments
 (0)