Skip to content
Stackdriver Profiler Python agent is a tool that continuously gathers CPU usage information from Python applications
Python C++ Go Shell C
Branch: master
Clone or download
nolanmar511 and cloud-profiler-team Modify Python agent to support building and using the agent on Alpine
PiperOrigin-RevId: 283451803
Latest commit df993e8 Dec 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
googlecloudprofiler Modify Python agent to support building and using the agent on Alpine Dec 3, 2019
kokoro
CONTRIBUTING.md
LICENSE Initial commit for the Python profiling agent Mar 6, 2019
MANIFEST.in
README.md
setup.py Modify Python agent to support building and using the agent on Alpine Dec 3, 2019

README.md

Stackdriver Python profiling agent

Python profiling agent for Stackdriver Profiler.

Installation & usage

  1. Install the profiler package using PyPI:

    pip3 install google-cloud-profiler
  2. Enable the profiler in your application:

    import googlecloudprofiler
    
    def main():
        # Profiler initialization. It starts a daemon thread which continuously
        # collects and uploads profiles. Best done as early as possible.
        try:
            googlecloudprofiler.start(
                service='hello-profiler',
                service_version='1.0.1',
                # verbose is the logging level. 0-error, 1-warning, 2-info,
                # 3-debug. It defaults to 0 (error) if not set.
                verbose=3,
                # project_id must be set if not running on GCP.
                # project_id='my-project-id',
            )
        except (ValueError, NotImplementedError) as exc:
            print(exc)  # Handle errors here

See Stackdriver Profiler profiling Python code for detailed documentation.

You can’t perform that action at this time.