Skip to content

Commit

Permalink
Update Python automatic instrumentation directions
Browse files Browse the repository at this point in the history
OTel Python automatic instrumentation doesn't support Flask or Werkzeug 3.0+.
This will be addressed in [this PR](open-telemetry/opentelemetry-python-contrib#2013)
As a result, the automatic instrumentation example doesn't work.
This has been an issue since Oct and reported in multiple issues across multiple repositories.
The getting started automatic instrumentation does work as it's pinned to versions less than 3.0.

Update the documentation for the automatic instrumentation so it work.
Addresses: open-telemetry/opentelemetry-python#3543
Also switch to venv over virtualenv to be consistent with getting started documentation
and to remove an additional dependency.

Once the above PR is merged, both the getting started and automatic instrumentation example
documentation should be updated to remove the pinning.
  • Loading branch information
flands committed Jan 4, 2024
1 parent 735babe commit b45885e
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions content/en/docs/instrumentation/python/automatic/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ following commands to prepare for auto-instrumentation:

```sh
mkdir auto_instrumentation
virtualenv auto_instrumentation
source auto_instrumentation/bin/activate
cd auto_instrumentation
python -m venv venv
source ./venv/bin/activate
```

## Install
Expand All @@ -100,9 +101,16 @@ which provides several commands that help automatically instrument a program.

```sh
pip install opentelemetry-distro
pip install opentelemetry-instrumentation-flask
pip install flask
pip install requests
pip install 'flask<3' 'werkzeug<3' requests
```

> **Note**: OpenTelemetry Python automatic instrumentation does not support Flask
> or Werkzeug 3.0+ at this time.
Run the `opentelemetry-bootstrap` command:

```shell
opentelemetry-bootstrap -a install
```

The examples that follow send instrumentation results to the console. Learn more
Expand Down Expand Up @@ -130,12 +138,12 @@ Execute the server in two separate consoles, one to run each of the scripts that
make up this example:

```sh
source auto_instrumentation/bin/activate
source ./venv/bin/activate
python server_manual.py
```

```sh
source auto_instrumentation/bin/activate
source ./venv/bin/activate
python client.py testing
```

Expand Down Expand Up @@ -254,12 +262,12 @@ Execute the server just like you would do for manual instrumentation, in two
separate consoles, one to run each of the scripts that make up this example:

```sh
source auto_instrumentation/bin/activate
source ./venv/bin/activate
python server_programmatic.py
```

```sh
source auto_instrumentation/bin/activate
source ./venv/bin/activate
python client.py testing
```

Expand Down

0 comments on commit b45885e

Please sign in to comment.