Skip to main content

Beacon Profiling for Python

The current stable version is beacon-profiling==0.1.0. 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 or a compatible pprof endpoint 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 (defaults to 60 seconds and can be overridden by the Profiler(export_interval=...) argument)

  • 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 (defaults to the profile export interval and can be overridden by the Profiler(memory_interval=...) argument)

  • 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.0

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.0
File Size Uploaded
beacon_profiling-0.1.0.tar.gz 40.7 kB Details

Built distribution (wheel)

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

Total release size: 85.6 kB

Release files / beacon_profiling-0.1.0.tar.gz

Download URL beacon_profiling-0.1.0.tar.gz
Size 40.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dc8520321ba3f950c081d61f538eec70c004081a9ddb6001a0e21d9730e183dd
BLAKE2b-256 checksum
How to use checksums
25157dc67df15771da9bf59305dee1cf7ba741bd4972f1e294a7260173b4ba63
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.0-py3-none-any.whl

Download URL beacon_profiling-0.1.0-py3-none-any.whl
Size 44.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7db1cf573d60af6b7f39c8a8a7113c6857ba385ff5141cf04e94cee9d0af0cc1
BLAKE2b-256 checksum
How to use checksums
97971e8a1c7d293e93b910a30aa5cbc71586def9c6c7dca38259b4baae954117
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

This release

0.1.0 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