Skip to main content

Pyroscope integration for Python

Project description

Pyroscope Python Integration

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

Basic Usage of Pyroscope

import pyroscope_io as pyroscope

pyroscope.configure(
  app_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
)

Adding Tags

Tags allow for users to view their data at different levels of granularity depending on what "slices" make sense for their application. This can be anything from region or microservice to more dynamic tags like controller or api route.

import os
import pyroscope_io as pyroscope

pyroscope.configure(
  app_name       = "simple.python.app",
  server_address = "http://my-pyroscope-server:4040",

  tags = {
    "hostname": os.getenv("HOSTNAME"),
  }
)

# You can use a wrapper:
with pyroscope.tag_wrapper({ "controller": "slow_controller_i_want_to_profile" }):
  slow_code()

Examples

For more examples see examples/python in the main repo.

Project details


Download files

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

Source Distribution

pyroscope-io-0.4.1.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distributions

pyroscope_io-0.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (8.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyroscope_io-0.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

pyroscope_io-0.4.1-cp39-cp39-macosx_11_0_arm64.whl (5.6 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyroscope_io-0.4.1-cp39-cp39-macosx_10_14_x86_64.whl (6.0 MB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pyroscope_io-0.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (8.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyroscope_io-0.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

pyroscope_io-0.4.1-cp38-cp38-macosx_11_0_arm64.whl (5.6 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyroscope_io-0.4.1-cp38-cp38-macosx_10_14_x86_64.whl (6.0 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

pyroscope_io-0.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (8.3 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyroscope_io-0.4.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

pyroscope_io-0.4.1-cp37-cp37m-macosx_10_14_x86_64.whl (6.0 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

pyroscope_io-0.4.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (8.3 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyroscope_io-0.4.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.4 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ ARM64

Supported by

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