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

Uploaded Python 3

File details

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

File metadata

  • Download URL: spakky_tracing-6.4.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.12

File hashes

Hashes for spakky_tracing-6.4.0.tar.gz
Algorithm Hash digest
SHA256 898c99cc0f7cd6bd5498a08104ed65e62940985131ee75e3409a1d590530e5d2
MD5 9cced2d5b0b8310c1bba34ea72184c34
BLAKE2b-256 41d06f427a922eb755bfa6fa9e8cd59c8ae5f816d5a4e841df36e87656c4d41a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_tracing-6.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: spakky_tracing-6.4.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.12

File hashes

Hashes for spakky_tracing-6.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 703ecbc4c537f6385db190536b6396602d867e35d7e0b92359d3148dfcdebe37
MD5 a382a2d22772d4e2f4c4085042714e67
BLAKE2b-256 ed4d5ed1d6b00ed9fb1345ff7f5920c512d0ce954f1f085cf39820c3e6c3487d

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_tracing-6.4.0-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