Skip to main content
Pre-release

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

Beacon Profiling for Python

This package is in development and has not been published as a Beacon release. The previously published Guance profiling package is a separate legacy release; see ../../beacon/README.md in this repository for status.

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()

Handled-exception collection requires Python sys.monitoring (Python 3.12+); on Python 3.10/3.11 the other collectors remain available.

Usage

Enable profiling for applications launched via beacon after installing beacon-otel[profiling]:

export OTEL_PROFILING_ENABLED=true
beacon 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
beacon 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"
beacon 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 beacon-profiling 0.1.0rc1

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

Source distribution (sdist)

Source distribution for beacon-profiling 0.1.0rc1
File Size Uploaded
beacon_profiling-0.1.0rc1.tar.gz 39.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for beacon-profiling 0.1.0rc1
File Interpreter ABI Platform
beacon_profiling-0.1.0rc1-py3-none-any.whl Python 3 none any Details

Total release size: 83.3 kB

Release files / beacon_profiling-0.1.0rc1.tar.gz

Download URL beacon_profiling-0.1.0rc1.tar.gz
Size 39.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b6a24bc44c03f1f558596e509f61a5a52723a20ff3437485c831d99003537acc
BLAKE2b-256 checksum
How to use checksums
1a55482fc1c21bb495f83f24e701c422997eb4defeb152d1cde09d2f5bd170b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / beacon_profiling-0.1.0rc1-py3-none-any.whl

Download URL beacon_profiling-0.1.0rc1-py3-none-any.whl
Size 44.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f330f3685b647e6925d9e756690f1586f86623e9196172471011f3148fbccb1b
BLAKE2b-256 checksum
How to use checksums
7a5c18cd1badd96a22a55d77d1906cf76475bd1d48be9978fb3821a2ca70db91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

This release

0.1.0rc1 This release

2 release files

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