TestNew | Basic middleware creation | Creates middleware with default options and processes requests successfully |
TestSpanCreation | Span generation | Creates span with correct name (HTTP method + path), generates TraceID and SpanID |
TestSpanAttributes | Attribute collection | Captures service.name, service.version, http.method, http.status_code, http.user_agent |
TestW3CTracePropagation | W3C Trace Context propagation | Inherits TraceID from parent, generates new SpanID, sets parent relationship, injects traceparent header |
TestB3Propagation | B3 single header format | Extracts trace context from B3 header, injects B3 headers in response |
TestB3MultiHeaderPropagation | B3 multi-header format | Extracts trace context from X-B3-* headers, maintains compatibility |
TestSkipPaths | Path filtering | Skips configured paths (e.g., /health), traces non-skipped paths |
TestSampler | Custom sampling | Respects sampler function, only creates spans for sampled requests |
TestErrorStatus | Error handling | Sets StatusError for HTTP 4xx/5xx responses, captures error attributes |
TestOnStartOnEnd | Lifecycle hooks | Calls OnStart when span begins, OnEnd when span completes |
TestGetSpan | Context access | Retrieves span from context, allows custom attributes and events |
TestSpanDuration | Timing measurement | Calculates span duration, sets end time correctly |
TestSpanContextIsValid | Context validation | Validates SpanContext has TraceID and SpanID |
TestSpanContextIsSampled | Sampling flag check | Correctly interprets trace flags for sampling decision |
TestInMemoryProcessor | Span processing | Stores spans, retrieves all spans, clears span storage |