Skip to main content

Honeycomb OpenTelemetry distro which embeds the C++ SDK

Project description

honeycomb-pycpp

OSS Lifecycle Build

Python bindings for the OpenTelemetry C++ SDK. Provides high-performance tracing via a Pythonic interface, and ships as an OpenTelemetry distro for drop-in use with auto-instrumentation.

This library is experimental.

Installation

pip install honeycomb-pycpp

The wheel bundles the OpenTelemetry C++ SDK — no system-level dependencies required.

Configuration

The SDK is configured via a YAML file following the OpenTelemetry Configuration File Format. A default config is embedded in the package and used when no override is provided.

Environment variable Description
OTEL_CONFIG_FILE Path to a custom configuration YAML. Overrides the embedded default.
OTEL_EXPORTER_OTLP_ENDPOINT OTLP endpoint (default: http://localhost:4318)
OTEL_EXPORTER_OTLP_HEADERS Headers to send with OTLP requests
OTEL_RESOURCE_ATTRIBUTES Comma-separated resource attributes
OTEL_SERVICE_NAME Service name

Usage

As a distro (auto-instrumentation)

opentelemetry-instrument --service-name my-service python app.py

The distro registers itself automatically via entry points — no code changes required.

Tracing

import honeycomb_pycpp as otel

# Initialize from config file (or uses embedded default)
provider = otel.TracerProvider("path/to/otel.yaml")

tracer = provider.get_tracer("my-tracer")

with tracer.start_as_current_span("my-span") as span:
    span.set_attribute("key", "value")
    # ... do work ...

Metrics

Install the system metrics instrumentor:

pip install opentelemetry-instrumentation-system-metrics

Then activate it programmatically after initializing the MeterProvider:

import honeycomb_pycpp as otel
from opentelemetry import metrics
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor

provider = otel.MeterProvider("path/to/otel.yaml")
metrics.set_meter_provider(provider)

SystemMetricsInstrumentor().instrument()

This collects CPU, memory, network, and other host metrics and exports them via the C++ SDK.

Logs

import honeycomb_pycpp as otel

provider = otel.LoggerProvider("path/to/otel.yaml")

logger = provider.get_logger("my-logger")

# Emit using keyword arguments
logger.emit(body="something happened", severity_number=otel.SeverityNumber.INFO)

# Emit using a LogRecord object
record = otel.LogRecord()
record.body = "request failed"
record.severity_number = otel.SeverityNumber.ERROR
record.attributes = {"user.id": "u-123", "http.status_code": 500}
logger.emit(record)

# Attach an exception
try:
    1 / 0
except ZeroDivisionError as exc:
    record = otel.LogRecord()
    record.body = "unhandled exception"
    record.severity_number = otel.SeverityNumber.ERROR
    record.exception = exc
    logger.emit(record)

provider.shutdown()

The LoggerProvider can also be used via bridges such that opentelemetry-instrumentation-logging work:

import logging
import honeycomb_pycpp as otel
from opentelemetry.instrumentation.logging.handler import LoggingHandler
from opentelemetry._logs import get_logger_provider

handler = LoggingHandler(logger_provider=otel.LoggerProvider("path/to/otel.yaml"))
logging.getLogger().addHandler(handler)

logging.getLogger("myapp").warning("watch out")

Deploying alongside the standard OpenTelemetry Python distro

Both honeycomb-pycpp and the standard opentelemetry-distro can be installed at the same time. When both are present, opentelemetry-instrument may pick up either distro. Use OTEL_PYTHON_DISTRO and OTEL_PYTHON_CONFIGURATOR to explicitly select which one runs.

pip install honeycomb-pycpp opentelemetry-distro

To use this C++ distro:

OTEL_PYTHON_DISTRO=cpp_distro \
OTEL_PYTHON_CONFIGURATOR=cpp_configurator \
opentelemetry-instrument python app.py

To use the standard Python SDK distro:

OTEL_PYTHON_DISTRO=distro \
OTEL_PYTHON_CONFIGURATOR=configurator \
opentelemetry-instrument python app.py

If neither variable is set and both distros are installed, the one selected is non-deterministic — always set them explicitly in multi-distro environments.

Current limitations

  • OpenTelemetry C++ ABI v2 not yet enabled, any features relying on it (i.e. links) are not supported

Building from source

Requirements: Python >= 3.10, CMake >= 3.15, C++17 compiler.

git clone https://github.com/honeycombio/honeycomb-pycpp
cd honeycomb-pycpp
pip install -r requirements-dev.txt
pip install -e .

To rebuild after C++ changes:

pip install -e . --force-reinstall --no-deps

To clean up cmake artifacts:

rm -rf CMakeCache.txt CMakeFiles/ cmake_install.cmake build/ dist/ *.egg-info/ *.so

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

honeycomb_pycpp-0.1.4-cp314-cp314-macosx_15_0_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.14macOS 15.0+ x86-64

honeycomb_pycpp-0.1.4-cp314-cp314-macosx_14_0_arm64.whl (14.3 MB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

honeycomb_pycpp-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

honeycomb_pycpp-0.1.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file honeycomb_pycpp-0.1.4-cp314-cp314-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for honeycomb_pycpp-0.1.4-cp314-cp314-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 f4077c13c460ce836ec75a96dd18d8b429777a07ee3cfe0d08b34f08bf186e83
MD5 d40d3474aea3590307a988ab0f088fc9
BLAKE2b-256 30d01ae483af236528de89a65b703ff9c7c077310978f04d000c04bf6513a860

See more details on using hashes here.

Provenance

The following attestation bundles were made for honeycomb_pycpp-0.1.4-cp314-cp314-macosx_15_0_x86_64.whl:

Publisher: build-wheels.yml on honeycombio/honeycomb-pycpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file honeycomb_pycpp-0.1.4-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for honeycomb_pycpp-0.1.4-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2b296e7baa20d82d295b4a77564fc1acb3ff1c5705f98aaf43945f3945aaf82e
MD5 d34ee710b819ae6ffe1d9ca15fcb4215
BLAKE2b-256 2336013b0c08708efeb06b93884ac88689d403c9106885b51ecac844d6d7bb29

See more details on using hashes here.

Provenance

The following attestation bundles were made for honeycomb_pycpp-0.1.4-cp314-cp314-macosx_14_0_arm64.whl:

Publisher: build-wheels.yml on honeycombio/honeycomb-pycpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file honeycomb_pycpp-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for honeycomb_pycpp-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8e39b0c650a37968dca8d5da39d1b204831065da1f954798fed706b2d804953
MD5 13dc52c035acf57701400752c7cb938e
BLAKE2b-256 4d5907bcaddc5883ef9f50cccd8690fd29962743a68c641bf59004d09f47088d

See more details on using hashes here.

Provenance

The following attestation bundles were made for honeycomb_pycpp-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on honeycombio/honeycomb-pycpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file honeycomb_pycpp-0.1.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for honeycomb_pycpp-0.1.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a1fa8c5e2066769eb95656a96e92d0f2589fe7304ae4c62987101e38c8e2c62d
MD5 ec249d0ae6552e965bd95202a8a060c1
BLAKE2b-256 c90e891d2b25c7afcea2717d8c565667e96afb07a5ea0ad75a44e83e14530d44

See more details on using hashes here.

Provenance

The following attestation bundles were made for honeycomb_pycpp-0.1.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on honeycombio/honeycomb-pycpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page