Skip to main content

Spakky Tracing

Spakky Framework를 위한 분산 트레이싱 추상화입니다. TraceContextITracePropagator로 HTTP, messaging, task boundary 사이의 trace metadata를 전달합니다.

설치

pip install spakky-tracing

주요 기능

  • TraceContext: contextvars를 지원하는 W3C Trace Context Level 2 호환 trace context
  • ITracePropagator: service boundary를 넘는 trace context propagation용 abstract interface
  • W3CTracePropagator: 내장 W3C traceparent header propagator
  • Async-safe: asyncio task별로 격리되는 contextvars 기반 context propagation
  • 외부 의존성 없음: 순수 Python 구현이며 spakky core에만 의존

빠른 시작

TraceContext 생성과 전파

from spakky.tracing.context import TraceContext

# 새 root trace 시작
ctx = TraceContext.new_root()
TraceContext.set(ctx)

# 현재 trace 접근
current = TraceContext.get()
print(current.to_traceparent())
# 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01

# child span 생성
child = current.child()
TraceContext.set(child)

들어오는 trace header 파싱

from spakky.tracing.context import TraceContext

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

W3CTracePropagator로 주입/추출

from spakky.tracing.w3c_propagator import W3CTracePropagator

propagator = W3CTracePropagator()

# 현재 trace를 outgoing header에 주입
carrier: dict[str, str] = {}
propagator.inject(carrier)
# carrier == {"traceparent": "00-...-...-01"}

# incoming header에서 trace 추출
ctx = propagator.extract(carrier)

개발 검증

패키지 단위 검증은 해당 패키지 디렉토리에서 실행합니다.

uv run ruff format .
uv run ruff check .
uv run pyrefly check
uv run pytest

pytest는 각 패키지 pyproject.toml의 coverage 설정을 사용합니다.

라이선스

MIT License

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-7.1.1.tar.gz (5.1 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-7.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spakky_tracing-7.1.1.tar.gz
Algorithm Hash digest
SHA256 383467ca5945c8e269d5c55da54b17be1020128db64d19aae54f92caee0e467e
MD5 07fe2f554172a3444e3cb8b99d706343
BLAKE2b-256 21ad4394cef0753f7b39aa3f90faee5c3052b4c33c24aaa4eacf1ed10b4efbce

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: spakky_tracing-7.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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-7.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89e79a27c0e6cc89c03cc92183f4727a9d8029dd97628289993a316e77843d8b
MD5 78087dc75dc8eb06362be2a95b35c153
BLAKE2b-256 d59f1d344a32c3aef708a9f71e47d48c46b4c625bcef6e5e1ec2eaa37a156105

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_tracing-7.1.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 Sentry Error logging StatusPage Status page