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.3.1.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.3.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spakky_tracing-6.3.1.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.3.1.tar.gz
Algorithm Hash digest
SHA256 212ddb18aec87b3859a57a924ab78764193be2d5e1824997d2d1e7bead35dad3
MD5 7b0721bda23078287628d363b797fba8
BLAKE2b-256 64c6952b2d6202c765c9bd33bdef3aff4dbd31e86ae2d0ad5a12206454452395

See more details on using hashes here.

Provenance

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

Publisher: release.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.3.1-py3-none-any.whl.

File metadata

  • Download URL: spakky_tracing-6.3.1-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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0abe356f438ab07b57cff6f4fc35637443c5572315771a7e485ef8f75cc6abf
MD5 68059b1018a28f68f66434309d806e2b
BLAKE2b-256 cd2ac6d95734102c85d1ce086d094e8be684f1ac14e0ba1cd330853dac29f91e

See more details on using hashes here.

Provenance

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

Publisher: release.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