Skip to main content

Distributed tracing abstraction for Spakky Framework

Project description

Spakky Tracing

Distributed tracing abstraction for Spakky Framework.

Installation

pip install spakky-tracing

Features

  • TraceContext: W3C Trace Context Level 2 compatible trace context with contextvars support
  • ITracePropagator: Abstract interface for trace context propagation across service boundaries
  • W3CTracePropagator: Built-in W3C traceparent header propagator
  • Async-safe: contextvars-based context propagation, isolated per asyncio task
  • Zero external dependencies: Pure Python implementation, depends only on spakky core

Quick Start

Create and Propagate Trace Context

from spakky.tracing.context import TraceContext

# Start a new root trace
ctx = TraceContext.new_root()
TraceContext.set(ctx)

# Access current trace
current = TraceContext.get()
print(current.to_traceparent())
# 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01

# Create a child span
child = current.child()
TraceContext.set(child)

Parse Incoming Trace Headers

from spakky.tracing.context import TraceContext

header = "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
ctx = TraceContext.from_traceparent(header)

Use W3CTracePropagator for Injection/Extraction

from spakky.tracing.w3c_propagator import W3CTracePropagator

propagator = W3CTracePropagator()

# Inject current trace into outgoing headers
carrier: dict[str, str] = {}
propagator.inject(carrier)
# carrier == {"traceparent": "00-...-...-01"}

# Extract trace from incoming headers
ctx = propagator.extract(carrier)

License

MIT License

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

spakky_tracing-6.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

spakky_tracing-6.2.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file spakky_tracing-6.2.0.tar.gz.

File metadata

  • Download URL: spakky_tracing-6.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spakky_tracing-6.2.0.tar.gz
Algorithm Hash digest
SHA256 29f59aadd8cd8cc699401ec25558a3590f71b037bab6c42a849fcd85ea8fb267
MD5 dd234619d67184fa9011986ac5b5077a
BLAKE2b-256 8ab31faf091587e41dc9ef384acfa8853e88ff994cb468707be5da2ee4b5efa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_tracing-6.2.0.tar.gz:

Publisher: publish-package.yml on E5presso/spakky-framework

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

File details

Details for the file spakky_tracing-6.2.0-py3-none-any.whl.

File metadata

  • Download URL: spakky_tracing-6.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spakky_tracing-6.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e26c6af68b25e74b7dd410153f2b35cb5f466bea778fcc79f2bc824615e0367d
MD5 629890fc97cfa48fc92e0bdb7865aa5a
BLAKE2b-256 d71ff28b3dd9f8ebe78712529dff7e5784468ac2915969285305e75f973a763f

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_tracing-6.2.0-py3-none-any.whl:

Publisher: publish-package.yml on E5presso/spakky-framework

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