Skip to main content

Pyroscope Python integration

Project description

Pyroscope Python Package

Pyroscope integration for Python

license tests build PyPI version PyPI


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyroscope_io-0.8.16-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.5 MB view details)

Uploaded Python 2Python 3manylinux: glibc 2.17+ x86-64

pyroscope_io-0.8.16-py2.py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.2 MB view details)

Uploaded Python 2Python 3manylinux: glibc 2.17+ ARM64

pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_x86_64.whl (3.4 MB view details)

Uploaded Python 2Python 3macOS 11.0+ x86-64

pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded Python 2Python 3macOS 11.0+ ARM64

File details

Details for the file pyroscope_io-0.8.16-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pyroscope_io-0.8.16-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6b91ce5b240f8de756c16a17022ca8e25ef8a4eed461c7d074b8a0841cf7b445
MD5 9882f7954b1d280d4eafab18830e2cc6
BLAKE2b-256 eb8f88d792e9cacd6ff3bd9a50100586ddc665e02a917662c17d30931f778542

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroscope_io-0.8.16-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: publish.yml on grafana/pyroscope-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyroscope_io-0.8.16-py2.py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for pyroscope_io-0.8.16-py2.py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 86f0f047554ff62bd92c3e5a26bc2809ccd467d11fbacb9fef898ba299dbda59
MD5 c2848f271674c799d9535db2a67c8f34
BLAKE2b-256 397a261f53ede16b7db19984ec80480572b8e9aa3be0ffc82f62650c4b9ca7d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroscope_io-0.8.16-py2.py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl:

Publisher: publish.yml on grafana/pyroscope-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 dc98355e27c0b7b61f27066500fe1045b70e9459bb8b9a3082bc4755cb6392b6
MD5 866b3d9956b3e128445788287643379e
BLAKE2b-256 5ec190fc335f2224da86d49016ebe15fb4f709c7b8853d4b5beced5a052d9ea3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_x86_64.whl:

Publisher: publish.yml on grafana/pyroscope-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e07edcfd59f5bdce42948b92c9b118c824edbd551730305f095a6b9af401a9e8
MD5 d6e8d4ba4ecc3a708f4a1b851d4cb286
BLAKE2b-256 a850607b38b120ba8adad954119ba512c53590c793f0cf7f009ba6549e4e1d77

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroscope_io-0.8.16-py2.py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on grafana/pyroscope-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page