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

Uploaded Python 3

File details

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

File metadata

  • Download URL: spakky_tracing-6.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 787bbd4b114f6e374e6f25d1799e5fdc097be659443f6257c08b8bdb45e5fb7e
MD5 b6c18d001646617fb49a7a029be6a154
BLAKE2b-256 7a57fd1eb3978aab1e367a30ea5464e60c93d8676fb639ba07fe32878b4324f7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: spakky_tracing-6.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afbbf002bb00886fd7788c8bd33456df273b482ea874874a8bee26b13924ae6e
MD5 c8218316c0342ceb9cd823cef161708e
BLAKE2b-256 e032df8addfaea1aa569190432e564c031e8c63a3ac3d1c248b3f79ce284138f

See more details on using hashes here.

Provenance

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