Skip to content

0.3.0

Choose a tag to compare

@Polliog Polliog released this 22 Dec 15:55
· 58 commits to main since this release

Added

  • Coroutine-safe Trace ID: Full support for Kotlin coroutines with proper trace ID propagation
    • TraceIdElement: A CopyableThreadContextElement that propagates trace ID across thread switches
    • withTraceIdSuspend(traceId, block): Execute suspend function with coroutine-safe trace ID
    • withNewTraceIdSuspend(block): Generate new trace ID for suspend functions
    • getTraceIdSuspend(): Get current trace ID from coroutine context
    • currentTraceId(): Top-level suspend function to get trace ID anywhere
  • Automatic Ktor Coroutine Integration: Trace ID is now automatically propagated in all Ktor route coroutines
    • Uses ApplicationCallPipeline.Call intercept to wrap requests with TraceIdElement
    • No manual wrapping needed - just use the LogWard client in your routes
    • Trace ID from X-Trace-ID header or auto-generated UUID

Changed

  • Trace ID ThreadLocal is now shared across the SDK for consistency
  • Ktor plugin now always generates a trace ID (from header or new UUID)
  • Response logging includes trace ID in metadata

Fixed

  • Trace ID no longer gets lost when coroutines switch threads
  • Trace ID properly propagates to child coroutines (launch/async)
  • Nested trace ID contexts now restore correctly