Honeycomb Beeline Python
raw JSON → 3.6.0 verified Fri May 01 auth: no python
Honeycomb's official instrumentation library for Python applications. Provides automatic tracing for web frameworks (Flask, Django, etc.), database queries, and HTTP calls. Current version 3.6.0, requires Python >=3.7,<4. Monthly releases with enhancements and bug fixes.
pip install honeycomb-beeline Common errors
error ModuleNotFoundError: No module named 'beeline' ↓
cause honeycomb-beeline is not installed.
fix
Run 'pip install honeycomb-beeline' to install the package.
error beeline.init() takes 0 positional arguments but 2 were given ↓
cause Wrong function signature. Users often try to import and call init from the submodule incorrectly.
fix
Use 'beeline.init(writekey=..., dataset=...)' with keyword arguments, not positional.
error ValueError: Dataset must be a non-empty string ↓
cause The dataset argument to beeline.init() is missing or empty.
fix
Provide a valid dataset name (string) to beeline.init(). Also check HONEYCOMB_DATASET environment variable is set if using default.
error TypeError: 'NoneType' object is not callable ↓
cause decorator @beeline.traced applied to a function that returns None or is a coroutine.
fix
Ensure the decorated function is synchronous and returns a value. For async functions, use @beeline.async_traced instead.
Warnings
breaking In v3.5.0, support for Python 3.5 and 3.6 was dropped. Upgrade to Python >=3.7. ↓
fix Upgrade your Python runtime to 3.7 or higher, and upgrade honeycomb-beeline to >=3.5.0.
breaking In v3.3.1, libhoney minimum version bumped to 2.0.0, which changed the event submission API. If you use libhoney directly, review breaking changes. ↓
fix Ensure any direct libhoney usage is updated to work with libhoney >=2.0.0. If using beeline alone, no action needed.
gotcha Do not call beeline.init() more than once. Subsequent calls are silently ignored if the beeline is already initialized. ↓
fix Ensure beeline.init() is called only once during application startup.
gotcha The beeline uses environment variables HONEYCOMB_WRITEKEY and HONEYCOMB_DATASET by default if not passed to init. If set, they override passed values. ↓
fix Be explicit: pass writekey and dataset to beeline.init(). Unset environment variables if you want to rely on arguments.
deprecated Classic ingest keys (32-character) are supported but deprecated in favour of API keys. Use a 64-character API key when possible. ↓
fix Switch to a standard Honeycomb API key (64 characters) instead of classic key.
Imports
- beeline wrong
from beeline import beelinecorrectimport beeline - init wrong
from beeline import initcorrectbeeline.init(writekey=..., dataset=...)
Quickstart
import beeline
from beeline import metrics
# Initialize the beeline
beeline.init(
writekey=os.environ.get('HONEYCOMB_WRITEKEY', ''),
dataset=os.environ.get('HONEYCOMB_DATASET', ''),
service_name='my-python-app'
)
@beeline.traced(name="my_function")
def my_function():
# Add custom fields to the current span
beeline.add_context_field("key", "value")
return "hello"
# Add a metric counter
metrics.counter("my_counter").add(1)