Pyroscope Python integration
Project description
Pyroscope Python Package
Pyroscope integration for Python
What is Pyroscope
Pyroscope is a tool that lets you continuously profile your applications to prevent and debug performance issues in your code. It consists of a low-overhead agent which sends data to the Pyroscope server which includes a custom-built storage engine. This allows for you to store and query any applications profiling data in an extremely efficient and cost effective way.
How to install Pyroscope for Python Applications
pip install pyroscope-io
Minimal Configuration
Add the following code to your application. This code will initialize pyroscope profiler and start profiling:
import pyroscope
pyroscope.configure(
application_name = "my.python.app", # replace this with some name for your application
server_address = "http://my-pyroscope-server:4040", # replace this with the address of your pyroscope server
)
Full Configuration
Optionally, you can configure several parameters:
import pyroscope
pyroscope.configure(
application_name = "my.python.app", # replace this with some name for your application
server_address = "http://my-pyroscope-server:4040", # replace this with the address of your pyroscope server
auth_token = "{YOUR_API_KEY}", # optional, if authentication is enabled, specify the API key
sample_rate = 100, # default is 100
detect_subprocesses = False, # detect subprocesses started by the main process; default is False
oncpu = True # report cpu time only; default is True
gil_only = True # only include traces for threads that are holding on to the Global Interpreter Lock; default is True
log_level = "info" # default is info, possible values: trace, debug, info, warn, error and critical
tags = {
"region": '{os.getenv("REGION")}',
}
)
Tags
You can add tags to certain parts of your code:
# You can use a wrapper:
with pyroscope.tag_wrapper({ "controller": "slow_controller_i_want_to_profile" }):
slow_code()
Example
Check out this example python project in our repository for examples of how you can use these features.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pyroscope_io-0.8.7-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyroscope_io-0.8.7-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 2, Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33897f08168d808848ff821af5e919b7af5503083ad26c293c9577ad79c373c8 |
|
MD5 | 4b735602ac1efc7b48cb84223dd67ac0 |
|
BLAKE2b-256 | 5babadac4ff54f3de7a22ac55b020745beb9414b8ec0dd24fce78453b7d92f0f |
File details
Details for the file pyroscope_io-0.8.7-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: pyroscope_io-0.8.7-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.3 MB
- Tags: Python 2, Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eac84e2e34f84a9ad4c369c573b1c463ccb77eacd4b1907ea695d100fe76bc5 |
|
MD5 | 8c8f60f9c8b2fd977f2f78f7aaebfe92 |
|
BLAKE2b-256 | fc47c14678cfd39f62a6463adb6668a547b7e746334d63e695e6122d54cc632d |
File details
Details for the file pyroscope_io-0.8.7-py2.py3-none-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: pyroscope_io-0.8.7-py2.py3-none-macosx_11_0_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 2, Python 3, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b6ad0fc538fbdf5bb8849ee70bd731631a5fea7df40ab4ba860e2c369bf1720 |
|
MD5 | 065488eb9cc6f10ea6136546682f20ed |
|
BLAKE2b-256 | d72f31cfa3751b3ea497a81a56714da8e42c22d7768cda2c0aa95b841ef3ac14 |
File details
Details for the file pyroscope_io-0.8.7-py2.py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pyroscope_io-0.8.7-py2.py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.5 MB
- Tags: Python 2, Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6535c8b07e6f1ad0fc2337a30ae263749b4e9a889266d9329615dfb400ee372 |
|
MD5 | f66dcb67c91aefbd0eaed314058eb3f1 |
|
BLAKE2b-256 | c311b5f3f90c5af3ec29d9e4f6ce7372387d4a6732c55bc5c22f0fd96d706929 |