Skip to main content

Honeycomb Samplers for OpenTelemetry

Project description

opentelemetry-samplers-python

NOTE: This is experimental and is subject to change a lot or go away entirely. Use with caution.

Honeycomb Samplers for use with the OpenTelemetry Python SDK

Samplers

Deterministic Sampler

This is a port of the deterministic sampler included in our Python Beeline. To use it, just instantiate it with a sample rate:

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
    ConsoleSpanExporter,
    SimpleExportSpanProcessor,
)
from opentelemetry.ext.honeycomb.sampling import DeterministicSampler

sampler = DeterministicSampler(5) # every trace has a 20% chance of being sampled
trace.set_tracer_provider(TracerProvider(sampler=sampler))

trace.get_tracer_provider().add_span_processor(
    SimpleExportSpanProcessor(ConsoleSpanExporter())
)

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("Test span"):
    with tracer.start_as_current_span("bar"):
        with tracer.start_as_current_span("baz"):
            print("Hello world from OpenTelemetry Python!")

Project details


Download files

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

Source Distribution

Built Distribution

File details

Details for the file opentelemetry-ext-honeycomb-samplers-0.3b0.tar.gz.

File metadata

  • Download URL: opentelemetry-ext-honeycomb-samplers-0.3b0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.9

File hashes

Hashes for opentelemetry-ext-honeycomb-samplers-0.3b0.tar.gz
Algorithm Hash digest
SHA256 80077df508934a137b0f2372982b0aa0f3bd5d5ed93545babd13f6a3fc1271e1
MD5 daefe31786c1f5a441f3248038a4673b
BLAKE2b-256 f46ca1fc6943def36172ea38877dac0119604db14aa063b4962b8fd7db225545

See more details on using hashes here.

File details

Details for the file opentelemetry_ext_honeycomb_samplers-0.3b0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_ext_honeycomb_samplers-0.3b0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e185ee13f24cb4b6590d91d766df768b78e8d0b4761bf56b88fc36247460f32
MD5 fb9eea302a8c3d7fdbd6dd2c8ebff633
BLAKE2b-256 7f517bcf63806c41c683b1d5704054204892bcb25d3c075212f2a0969615f054

See more details on using hashes here.

Supported by

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