Skip to main content


Supported platforms#


Profiling Python applications#

First, install pyroscope-io pip package:

pip install pyroscope-io

Basic Configuration#

Add the following code to your application. This code will initialize pyroscope profiler and start profiling:

import pyroscope
pyroscope.configure(  app_name       = "", # 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}", # optionally, if authentication is enabled, specify the API key)


Pyroscope python integration provides a number of ways to tag profiling data. For example, you can provide tags when you're initializing the profiler:

import osimport pyroscope
pyroscope.configure(  app_name       = "",  server_address = "http://my-pyroscope-server:4040",
  tags = {    "hostname": os.getenv("HOSTNAME"),  })

or you can dynamically tag certain parts of your code:

# You can use a wrapper:with pyroscope.tag_wrapper({ "controller": "slow_controller_i_want_to_profile" }):  slow_code()
# Or you can add / remove tags manually:pyroscope.tag({ "controller": "slow_controller_i_want_to_profile" })slow_code()pyroscope.remove_tags("controller")


Check out this example python project in our repository for examples of how you can use these features.