Documentation ¶
Index ¶
- type Batch
- type MockDatadogServer
- func (s *MockDatadogServer) Close()
- func (s *MockDatadogServer) ExpectDurationNoSpan(t *testing.T, duration time.Duration, name string)
- func (s *MockDatadogServer) ExpectNoSpan(t *testing.T, name string)
- func (s *MockDatadogServer) ExpectSpan(t *testing.T, name string, parents ...string)
- func (s *MockDatadogServer) ExpectSpanFn(t *testing.T, name string, fn func(span Span) bool, msg string, ...)
- func (s *MockDatadogServer) Reset()
- func (s *MockDatadogServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *MockDatadogServer) SetTracePath(path string)
- func (s *MockDatadogServer) WaitDurationForSpan(t *testing.T, duration time.Duration, name string, parents ...string)
- func (s *MockDatadogServer) WaitForSpan(t *testing.T, name string, parents ...string)
- type Span
- type Trace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch []Trace
Batch contains a collection of traces sent in bulk to the server.
func (Batch) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type MockDatadogServer ¶
type MockDatadogServer struct {
// contains filtered or unexported fields
}
MockDatadogServer is a test server that collects traces sent via Datadog's tracing library.
func New ¶
func New(opts ...tracer.StartOption) *MockDatadogServer
New creates a new MockDatadogServer. This should only be ever used as a singleton due to the fact that the Datadog tracer library uses global state for publishing.
func (*MockDatadogServer) Close ¶
func (s *MockDatadogServer) Close()
Close the underlying test server.
func (*MockDatadogServer) ExpectDurationNoSpan ¶
ExpectDurationNoSpan ensures that the named span has not been received in the given duration.
func (*MockDatadogServer) ExpectNoSpan ¶
func (s *MockDatadogServer) ExpectNoSpan(t *testing.T, name string)
ExpectNoSpan ensures that the named span has not been received within 100 milliseconds.
func (*MockDatadogServer) ExpectSpan ¶
func (s *MockDatadogServer) ExpectSpan(t *testing.T, name string, parents ...string)
Expect a named span with the given optional parents to have been received.
func (*MockDatadogServer) ExpectSpanFn ¶
func (s *MockDatadogServer) ExpectSpanFn(t *testing.T, name string, fn func(span Span) bool, msg string, args ...interface{})
Expect a named span with the given verification function to exist.
func (*MockDatadogServer) Reset ¶
func (s *MockDatadogServer) Reset()
Reset the internal state of the server between test runs.
func (*MockDatadogServer) ServeHTTP ¶
func (s *MockDatadogServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the main handler for requests from the tracing library.
func (*MockDatadogServer) SetTracePath ¶
func (s *MockDatadogServer) SetTracePath(path string)
SetTracePath changes the url path for which the mock server accepts Datadog traces.
func (*MockDatadogServer) WaitDurationForSpan ¶
func (s *MockDatadogServer) WaitDurationForSpan(t *testing.T, duration time.Duration, name string, parents ...string)
WaitDurationForSpan waits a sepecified duration for the server to receive the named span with optional parent matching.
func (*MockDatadogServer) WaitForSpan ¶
func (s *MockDatadogServer) WaitForSpan(t *testing.T, name string, parents ...string)
WaitForSpan waits 10 milliseconds for the server to receive the named span with optional parent matching.
type Span ¶
type Span struct { Name string `msg:"name"` Service string `msg:"service"` Resource string `msg:"resource"` Type string `msg:"type"` Start int64 `msg:"start"` Duration int64 `msg:"duration"` Meta map[string]string `msg:"meta,omitempty"` Metrics map[string]float64 `msg:"metrics,omitempty"` SpanID uint64 `msg:"span_id"` TraceID uint64 `msg:"trace_id"` ParentID uint64 `msg:"parent_id"` Error int32 `msg:"error"` }
Span represents a single span.
func (*Span) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Trace ¶
type Trace []Span
Trace contains a collection of associated spans.
func (Trace) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler