Skip to content

Commit b45885e

Browse files
committed
Update Python automatic instrumentation directions
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.
1 parent 735babe commit b45885e

File tree

1 file changed

+17
-9
lines changed
  • content/en/docs/instrumentation/python/automatic

1 file changed

+17
-9
lines changed

content/en/docs/instrumentation/python/automatic/example.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ following commands to prepare for auto-instrumentation:
8787

8888
```sh
8989
mkdir auto_instrumentation
90-
virtualenv auto_instrumentation
91-
source auto_instrumentation/bin/activate
90+
cd auto_instrumentation
91+
python -m venv venv
92+
source ./venv/bin/activate
9293
```
9394

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

101102
```sh
102103
pip install opentelemetry-distro
103-
pip install opentelemetry-instrumentation-flask
104-
pip install flask
105-
pip install requests
104+
pip install 'flask<3' 'werkzeug<3' requests
105+
```
106+
107+
> **Note**: OpenTelemetry Python automatic instrumentation does not support Flask
108+
> or Werkzeug 3.0+ at this time.
109+
110+
Run the `opentelemetry-bootstrap` command:
111+
112+
```shell
113+
opentelemetry-bootstrap -a install
106114
```
107115

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

132140
```sh
133-
source auto_instrumentation/bin/activate
141+
source ./venv/bin/activate
134142
python server_manual.py
135143
```
136144

137145
```sh
138-
source auto_instrumentation/bin/activate
146+
source ./venv/bin/activate
139147
python client.py testing
140148
```
141149

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

256264
```sh
257-
source auto_instrumentation/bin/activate
265+
source ./venv/bin/activate
258266
python server_programmatic.py
259267
```
260268

261269
```sh
262-
source auto_instrumentation/bin/activate
270+
source ./venv/bin/activate
263271
python client.py testing
264272
```
265273

0 commit comments

Comments
 (0)