Documentation ¶
Index ¶
Constants ¶
const ( // BaggageKey is used for testing baggage propagation BaggageKey = "luggage" // BaggageValue is used for testing baggage propagation BaggageValue = "suitcase" )
Variables ¶
This section is empty.
Functions ¶
func MockTracerSampledSpans ¶
func MockTracerSampledSpans(tracer *mocktracer.MockTracer) []*mocktracer.MockSpan
MockTracerSampledSpans is a helper function that returns only sampled spans from MockTracer
Types ¶
type EncodingInfo ¶
type EncodingInfo struct { Format tchannel.Format HeadersSupported bool }
EncodingInfo describes the encoding used with tracing propagation test
type PropagationTestCase ¶
type PropagationTestCase struct { ForwardCount int TracingDisabled bool ExpectedBaggage string ExpectedSpanCount int }
PropagationTestCase describes a single propagation test case and expected results
type PropagationTestSuite ¶
type PropagationTestSuite struct { Encoding EncodingInfo Register func(t *testing.T, ch *tchannel.Channel) TracingCall TestCases map[TracerType][]PropagationTestCase }
PropagationTestSuite is a collection of test cases for a certain encoding
func (*PropagationTestSuite) Run ¶
func (s *PropagationTestSuite) Run(t *testing.T)
Run executes the test cases in the test suite against 3 different tracer implementations
type TraceHandler ¶
type TraceHandler struct {
Ch *tchannel.Channel
}
TraceHandler is a base class for testing tracing propagation
func (*TraceHandler) HandleCall ¶
func (h *TraceHandler) HandleCall( ctx context.Context, req *TracingRequest, downstream TracingCall, ) (*TracingResponse, error)
HandleCall is used by handlers from different encodings as the main business logic. It respects the ForwardCount input parameter to make downstream calls, and returns a result containing the observed tracing span and the downstream results.
type TracerType ¶
type TracerType string
TracerType is a convenient enum to indicate which type of tracer is being used in the test. It is a string because it's printed as part of the test description in the logs.
const ( // Noop is for the default no-op tracer from OpenTracing Noop TracerType = "NOOP" // Mock tracer, baggage-capable, non-Zipkin trace IDs Mock TracerType = "MOCK" // Jaeger is Uber's tracer, baggage-capable, Zipkin-style trace IDs Jaeger TracerType = "JAEGER" )
type TracingCall ¶
type TracingCall func(ctx context.Context, req *TracingRequest) (*TracingResponse, error)
TracingCall is used in a few other structs here
type TracingRequest ¶
type TracingRequest struct { // ForwardCount tells the server how many times to forward this request to itself recursively ForwardCount int }
TracingRequest tests tracing capabilities in a given server.
type TracingResponse ¶
type TracingResponse struct { TraceID uint64 SpanID uint64 ParentID uint64 TracingEnabled bool Child *TracingResponse Luggage string }
TracingResponse captures the trace info observed in the server and its downstream calls
func (*TracingResponse) ObserveSpan ¶
func (r *TracingResponse) ObserveSpan(ctx context.Context) *TracingResponse
ObserveSpan extracts an OpenTracing span from the context and populates the response.