@@ -3,7 +3,7 @@ title: Python zero-code instrumentation
3
3
linkTitle : Python
4
4
weight : 30
5
5
aliases : [/docs/languages/python/automatic]
6
- cSpell:ignore : devel distro myapp
6
+ cSpell:ignore : distro myapp
7
7
---
8
8
9
9
Automatic instrumentation with Python uses a Python agent that can be attached
@@ -45,6 +45,13 @@ Running `opentelemetry-bootstrap` without arguments lists the recommended
45
45
instrumentation libraries to be installed. For more information, see
46
46
[ ` opentelemetry-bootstrap ` ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation#opentelemetry-bootstrap ) .
47
47
48
+ {{% alert title="Using <code >uv</code >?" color="warning" %}} If you are using
49
+ the [ uv] ( https://docs.astral.sh/uv/ ) package manager, you might face some
50
+ difficulty when running ` opentelemetry-bootstrap -a install ` . For details, see
51
+ [ Bootstrap using uv] ( troubleshooting/#bootstrap-using-uv ) . {{% /alert %}}
52
+
53
+ {#configuring-the-agent}
54
+
48
55
## Configuring the agent
49
56
50
57
The agent is highly configurable.
@@ -86,68 +93,5 @@ For the full list, see the
86
93
87
94
## Troubleshooting
88
95
89
- ### Python package installation failure
90
-
91
- The Python package installs require ` gcc ` and ` gcc-c++ ` , which you may need to
92
- install if you’re running a slim version of Linux, such as CentOS.
93
-
94
- <!-- markdownlint-disable blanks-around-fences -->
95
-
96
- - CentOS
97
- ``` sh
98
- yum -y install python3-devel
99
- yum -y install gcc-c++
100
- ```
101
- - Debian/Ubuntu
102
- ``` sh
103
- apt install -y python3-dev
104
- apt install -y build-essential
105
- ```
106
- - Alpine
107
- ``` sh
108
- apk add python3-dev
109
- apk add build-base
110
- ```
111
-
112
- ### gRPC Connectivity
113
-
114
- To debug Python gRPC connectivity issues, set the following gRPC debug
115
- environment variables:
116
-
117
- ``` sh
118
- export GRPC_VERBOSITY=debug
119
- export GRPC_TRACE=http,call_error,connectivity_state
120
- opentelemetry-instrument python YOUR_APP.py
121
- ```
122
-
123
- ### Bootstrap using uv
124
-
125
- When using the [ uv] ( https://docs.astral.sh/uv/ ) package manager, you might face
126
- some difficulty when running ` opentelemetry-bootstrap -a install ` .
127
-
128
- Instead, you can generate the requirements dynamically and install them using
129
- ` uv ` .
130
-
131
- First, install the appropriate packages (or add them to your project file and
132
- run ` uv sync ` ):
133
-
134
- ``` sh
135
- uv pip install opentelemetry-distro opentelemetry-exporter-otlp
136
- ```
137
-
138
- Now, you can install the auto instrumentation:
139
-
140
- ``` sh
141
- uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -
142
- ```
143
-
144
- Finally, use ` uv run ` to start your application (see
145
- [ Configuring the agent] ( #configuring-the-agent ) ):
146
-
147
- ``` sh
148
- uv run opentelemetry-instrument python myapp.py
149
- ```
150
-
151
- Please note that you have to reinstall the auto instrumentation every time you
152
- run ` uv sync ` or update existing packages. It is therefore recommended to make
153
- the installation part of your build pipeline.
96
+ For general troubleshooting steps and solutions to specific issues, see
97
+ [ Troubleshooting] ( ./troubleshooting/ ) .
0 commit comments