Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Guance SDK Extension for Python Profiling

This package provides a Python profiling runtime for OpenTelemetry auto-instrumentation. The current implementation exports profiles via OTLP and supports multiple collector types:

  • stack sampling

  • handled exceptions

  • threading and asyncio lock contention

  • threading and asyncio condition wait time

  • heap snapshots via tracemalloc

  • child-process restart after fork()

Installation

pip install guance-sdk-extension-profiling

or install it through the distro extra:

pip install guance-opentelemetry-distro[profiling]

Usage

Enable profiling for applications launched via opentelemetry-instrument:

export OTEL_PROFILING_ENABLED=true
opentelemetry-instrument python app.py

Programmatic usage:

from opentelemetry.sdk.extension.profiling import Profiler

profiler = Profiler()
profiler.start()

Configuration

The following environment variables are supported:

  • OTEL_PROFILING_ENABLED

  • OTEL_PROFILING_EXPORTER (otlp or pprof)

  • OTEL_PROFILING_SAMPLE_INTERVAL

  • OTEL_PROFILING_EXPORT_INTERVAL

  • OTEL_PROFILING_MAX_FRAMES

  • OTEL_PROFILING_INCLUDE_TRACE_CONTEXT

  • OTEL_PROFILING_EXCEPTION_ENABLED

  • OTEL_PROFILING_EXCEPTION_SAMPLING_INTERVAL

  • OTEL_PROFILING_EXCEPTION_COLLECT_MESSAGE

  • OTEL_PROFILING_LOCK_ENABLED

  • OTEL_PROFILING_MEMORY_ENABLED

  • OTEL_PROFILING_MEMORY_INTERVAL

  • OTEL_PROFILING_MEMORY_TOP_STATS

  • OTEL_PROFILING_MEMORY_IGNORE_PROFILER

  • OTEL_EXPORTER_OTLP_PROFILES_PROTOCOL

  • OTEL_EXPORTER_OTLP_PROFILES_ENDPOINT

  • OTEL_EXPORTER_OTLP_PROFILES_HEADERS

  • OTEL_EXPORTER_OTLP_PROFILES_TIMEOUT

  • OTEL_EXPORTER_OTLP_PROFILES_COMPRESSION

  • OTEL_EXPORTER_OTLP_PROFILES_CERTIFICATE

  • OTEL_EXPORTER_OTLP_PROFILES_CLIENT_KEY

  • OTEL_EXPORTER_OTLP_PROFILES_CLIENT_CERTIFICATE

  • OTEL_PROFILING_PPROF_PATH

  • OTEL_PROFILING_PPROF_UPLOAD_URL

  • OTEL_PROFILING_PPROF_HEADERS

Service metadata should be configured with standard OpenTelemetry resource settings such as OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES.

Examples

Collect stack, exception, lock, and heap profiles and export them with OTLP/HTTP:

export OTEL_PROFILING_ENABLED=true
export OTEL_PROFILING_EXCEPTION_ENABLED=true
export OTEL_PROFILING_LOCK_ENABLED=true
export OTEL_PROFILING_MEMORY_ENABLED=true
export OTEL_EXPORTER_OTLP_PROFILES_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_PROFILES_ENDPOINT=http://localhost:4318/v1development/profiles
opentelemetry-instrument python app.py

To dump pprof files instead of OTLP, set:

export OTEL_PROFILING_EXPORTER=pprof
export OTEL_PROFILING_PPROF_PATH=/tmp/otel-profile

To POST pprof directly to a compatible agent endpoint and keep a local copy:

export OTEL_PROFILING_PPROF_UPLOAD_URL=http://localhost:9529/profiling/v1/input
export OTEL_PROFILING_PPROF_HEADERS="X-API-Key:xxx"
opentelemetry-instrument python app.py

When OTEL_PROFILING_EXPORTER is unset and OTEL_PROFILING_PPROF_UPLOAD_URL is configured, the runtime defaults to a legacy-compatible pprof upload layout. Set OTEL_PROFILING_EXPORTER=otlp to force OTLP profile export.

Metadata

Release files for guance-sdk-extension-profiling 0.63b5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guance-sdk-extension-profiling 0.63b5
File Size Uploaded Provenance Actions
guance_sdk_extension_profiling-0.63b5.tar.gz 34.8 kB Without provenance Details for guance_sdk_extension_profiling-0.63b5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for guance-sdk-extension-profiling 0.63b5
File Interpreter ABI Platform Actions
guance_sdk_extension_profiling-0.63b5-py3-none-any.whl Python 3 none any Details for guance_sdk_extension_profiling-0.63b5-py3-none-any.whl

Total release size: 74.6 kB

Release files / guance_sdk_extension_profiling-0.63b5.tar.gz

Download URL guance_sdk_extension_profiling-0.63b5.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8867f8c9efb028b4dc49801f20ed9bf6d528caf14c4db7cfdd2d6356217b7b4f
BLAKE2b-256 checksum
How to use checksums
38e46090b9902e2a205c5fdd438ce7f6247ea24aba066e7d6e2b75dc929ef146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / guance_sdk_extension_profiling-0.63b5-py3-none-any.whl

Download URL guance_sdk_extension_profiling-0.63b5-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
945639eabe4c45c16af95de321ff2ba628c9880231a6bdfbc10f0e7ce0776d8a
BLAKE2b-256 checksum
How to use checksums
99cb4e5af1d65f8296660783865c8d92b1cee243ad4d7aeddd7021a122c7af58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for guance-sdk-extension-profiling 0.63b5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page