Google Cloud Profiler Python Agent
Project description
Google Cloud Python profiling agent
Python profiling agent for Google Cloud Profiler.
See Google Cloud Profiler profiling Python code for detailed documentation.
Supported OS
Linux. Profiling Python applications is supported for Linux kernels whose
standard C library is implemented with glibc
or with musl
. For configuration
information specific to Linux Alpine kernels, see
Running on Linux Alpine.
Supported Python Versions
Python >= 3.6
Installation & usage
-
Install the profiler package using PyPI:
pip3 install google-cloud-profiler
-
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
Installation on Linux Alpine
The Python profiling agent has a native component. The base Alpine image for
Python does not have all dependencies required to build this native component
installed. To build the Python profiling agent on Alpine, one must install the
package build-base
.
To use the Python profiling agent on Alpine without installing additional dependencies on to the final Alpine image, one can use a two-stage build and compile the Python profiling agent in the first stage.
Here is an example of a Docker image that uses a multi-stage build to compile and install the Python profiling agent:
FROM python:3.7-alpine as builder
# Install build-base to allow for compilation of the profiling agent.
RUN apk add --update --no-cache build-base
# Compile the profiling agent, generating wheels for it.
RUN pip3 wheel --wheel-dir=/tmp/wheels google-cloud-profiler
FROM python:3.7-alpine
# Copy over the directory containing wheels for the profiling agent.
COPY --from=builder /tmp/wheels /tmp/wheels
# Install the profiling agent.
RUN pip3 install --no-index --find-links=/tmp/wheels google-cloud-profiler
# Install any other required modules or dependencies, and copy an app which
# enables the profiler as described in "Enable the profiler in your
# application".
COPY ./bench.py .
# Run the application when the docker image is run, using either CMD (as is done
# here) or ENTRYPOINT.
CMD python3 -u bench.py
Troubleshooting
Resource temporarily unavailable errors with Python
If you see the following log entries after enabling the Profiler:
BlockingIOError: [Errno 11] Resource temporarily unavailable
Exception ignored when trying to write to the signal wakeup fd
see https://cloud.google.com/profiler/docs/troubleshooting#python-blocking for the cause and the workaround.
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 Distribution
Built Distributions
File details
Details for the file google-cloud-profiler-wheels-4.0.0.tar.gz
.
File metadata
- Download URL: google-cloud-profiler-wheels-4.0.0.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fb3c8af4e29278fe98885bfc9f0f7a581e6324479a1eceddf8fab77ddc896e8 |
|
MD5 | 650745309d818f7a083cffef363ab398 |
|
BLAKE2b-256 | 79d3a5f6b5f4634054778271b8405cb1ccba1dafaedbf182bf929253cce52d66 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd64def9890ddb71d5dd85347dbd17c7a082e6b1cb0d9736b42e75bff5a6e3b |
|
MD5 | 834fd7576a805713631c1a7b5c56a1fa |
|
BLAKE2b-256 | e232e8e17c838c826caf6e157cc23317e32c28955ce6de6f6d4fa01b1fbd76f9 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp310-cp310-musllinux_1_1_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp310-cp310-musllinux_1_1_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22e826f19d74a33dc4679fa0c07095202e90dafe8b589e0755a77a116abafb9b |
|
MD5 | 6271cadba1400eccb5f5e56ddee7538f |
|
BLAKE2b-256 | 87e889e84b707f992fce6bddea24c66c4ca21e63e69777246c2205cec261983b |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 739.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d061a3995002acad7400444bbb80c02898c5c2372fc36031dac20702d7f34eb0 |
|
MD5 | d32eba8c9ebe5ccb504ad5cf41e782f7 |
|
BLAKE2b-256 | a0e4f4448357d791806b085d421a8faa5f8207b52997104e74f539e4e424693a |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 777.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf2cc83e531c27307f5e3d1f5c2d9e1fba7a734d4a3fe8184806d6fde3fe8917 |
|
MD5 | b1ef47abe90926373152e29ff9a7f101 |
|
BLAKE2b-256 | 70ac6c6db8282ae023fa0caaa219b24766a0746c6fa210954f487f72b9c7cbb5 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02c1afc3544084153fbdd1382e9a64208bf5ba171c4a4385c9e18cbced06d6c |
|
MD5 | cdcc6955eaeb298860e1864d0fdbccd3 |
|
BLAKE2b-256 | 59c08ae0bff2681d23709930c7a01745846a70853f15f2564489d3801da23dd0 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp39-cp39-musllinux_1_1_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp39-cp39-musllinux_1_1_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b153b6f57f95d1f6a6901502cf5478d772788027c0fff1dc551aa8b9d0d6e819 |
|
MD5 | 46b07a025f448b122476c20fdf10c86e |
|
BLAKE2b-256 | dca43eb9b6a2aaa50812bfab41b34901bfc420c0a35350d6e6758fbb27a91e47 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 739.5 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66392b7bfc2d739cc2d976767b17c8d1fb02ed4982bfaa351a0f6740c6646c96 |
|
MD5 | e3c9ef69435c575af8c1bbe36bd61b2f |
|
BLAKE2b-256 | 2c49d24a553ae0ec7012bbbd429906d1a194f8390664068435c63b1319805662 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 777.3 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561bf98113da731215d52a2e88fa3b24a97cdbce6c4c72b51186b7d02912af06 |
|
MD5 | 7fe3d36707d3030483edc6f646bb94b5 |
|
BLAKE2b-256 | 27a353b3c65ea3060fa92d9f36beeecff77c331fd8117af480b81cdd013a8599 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3653eb013e741d58997fdb5929bb5696434012d51657bc9fb6a66da108eb3c |
|
MD5 | b7db2a563374dc3ff711738e9003d5e3 |
|
BLAKE2b-256 | 0c0a3177ad8c98302193a24d59184ba48ddead598a54d69222cbc296be478c1f |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp38-cp38-musllinux_1_1_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp38-cp38-musllinux_1_1_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.8, musllinux: musl 1.1+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fec2eaa6c27768f5c6dbec3c540f6259f3bc89f539dc14f646af098968f9879 |
|
MD5 | 7f5a4d6d1beabe847c62abe3c3efd82b |
|
BLAKE2b-256 | ea9a6d67e4dd16109ffaad46a33027f16c8aff8a770d0ae190e6487d9afe5b3a |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 739.8 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eff8f109cb54311a5b0aa22da061ab956ea3e2116365da8625407befe287ea85 |
|
MD5 | df8a9d512556557b36b9d3d5c0665381 |
|
BLAKE2b-256 | c5c5e22e7ea6d698599dcd4c85233fa7e0c778312d275ad6567b201a1edd0f8a |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 777.7 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdd490f69fa1b0397d602c7a67a2a187aa6fb467596cad9c0559156bd0bfdc8f |
|
MD5 | ba16a87608ede60dcd7fd773245c7143 |
|
BLAKE2b-256 | 3fee759b1f14b63666942c826346fe3d3277463fad9749e78c5de4bbc86f9750 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp37-cp37m-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp37-cp37m-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.7m, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da66934b78986fa2635b654b7a311628bdb5cd0645dd25345f7210fe5621e2f5 |
|
MD5 | d8d929ad7e7406e01c948509885bdd36 |
|
BLAKE2b-256 | 11e729fc744a5489fbe0a7879cdd1fbe62d231b599d3a0d37d5b3053602dee2b |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp37-cp37m-musllinux_1_1_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp37-cp37m-musllinux_1_1_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.7m, musllinux: musl 1.1+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2e484aec5fd6287af202f2e3256c9d8baf7a64b386ee5c98957df360a5c3447 |
|
MD5 | f69a35746515e1aa02685edaa053f2b2 |
|
BLAKE2b-256 | d7bcc8d85efb5d5b9ad628097d1bdb461bb0acd5673988c9778ae1d1eb9f7b36 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 740.2 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0abf14c03619f53bf143ebabeecfa6b3e5a18d9717cf7f93b6d8a1918dc53f86 |
|
MD5 | 2a9288f4e250d5ce4845487ea456588e |
|
BLAKE2b-256 | 8c8f4b07399f9d112bc22493a13d934c07d7a0edb6015f317ea2b6c80e275485 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 778.0 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65e39b62a6d632d8cf0eabb5a742c0b9a4c4922c6c63c6212389707692346245 |
|
MD5 | 33330ecc66b856f48f6b7e4f9c7cedb7 |
|
BLAKE2b-256 | c44e57b1b7afe1d42d1129b4be3086c50c06306b021af9d212d7b59c15efe8ef |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp36-cp36m-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp36-cp36m-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.6m, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 106f564c730d1ccb0864aa1e2a0a8beadb509e7478f1afea10ba50dad391e3d9 |
|
MD5 | a35dbc952aef87bc1fbaef5dad8da512 |
|
BLAKE2b-256 | 75c32fba85795423f5840c5f2c6730487e6272efbe8ac4501222c6ddf72213fc |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp36-cp36m-musllinux_1_1_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp36-cp36m-musllinux_1_1_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.6m, musllinux: musl 1.1+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c1c5e1cbb5d77f7b56df4c40479b53cbb33f442def2b59e522aa435ef6270f |
|
MD5 | f658349be6a54c10c779f1d7734114b1 |
|
BLAKE2b-256 | 65bfbe775fa1fe872eed040016a77c8ff12471a2653d269a18d5cccb447aad63 |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 739.4 kB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c004a045b8cbd3f44162d5370b185519140c8f0e51e11b9768cb2e2ded820f6 |
|
MD5 | 3cc6cf5d3910ac9e7f35556788498ef5 |
|
BLAKE2b-256 | cff3c09517ea7d93eb29bed637539327d9ef0f2e07ecf8acbc10ff90fda6a77a |
File details
Details for the file google_cloud_profiler_wheels-4.0.0-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: google_cloud_profiler_wheels-4.0.0-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 777.1 kB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f97a270ea3c4eef6e59c87a60e8f4bf3d98299e098cce9d8ef74b3db5ae3f41 |
|
MD5 | c9f49169f87914fadf193c0700ae96fc |
|
BLAKE2b-256 | 0df166222f7bd56f5354ecf0608d5b3a427b2204cd5021e16827366330de2b1a |