Documentation
¶
Overview ¶
Package fixtures provides easy ways to generate some random or deterministic data that can be use for tests or benchmarks.
All the publicly shared trace agent model is available.
It avoids the cumbersome step of having to redefine complicated structs in every test case and maintain common methods for quick access to almost all kind of stub data needed. It should NEVER be imported in a program, most likely in one-off projects or fuzz modes or test suites.
Index ¶
- Variables
- func GetTestSpan() *model.Span
- func GetTestTrace(traceN, size int, realisticIDs bool) model.Traces
- func RandomServices(maxServices, maxTags int) model.ServicesMetadata
- func RandomSpan() *model.Span
- func RandomSpanDuration() int64
- func RandomSpanError() int32
- func RandomSpanID() uint64
- func RandomSpanMeta() map[string]string
- func RandomSpanMetrics() map[string]float64
- func RandomSpanName() string
- func RandomSpanParentID() uint64
- func RandomSpanResource() string
- func RandomSpanService() string
- func RandomSpanStart() int64
- func RandomSpanTraceID() uint64
- func RandomSpanType() string
- func RandomStatsBucket(n int) model.StatsBucket
- func RandomTrace(maxLevels, maxSpans int) model.Trace
- func RandomWeightedSpan() *model.WeightedSpan
- func StatsBucketWithSpans(spans []*model.WeightedSpan) model.StatsBucket
- func TestDistribution() model.Distribution
- func TestSpan() *model.Span
- func TestStatsBucket() model.StatsBucket
- func TestWeightedSpan() *model.WeightedSpan
Constants ¶
This section is empty.
Variables ¶
var TestDistroValues = []int64{}/* 1000 elements not displayed */
TestDistroValues is a pre-defined list of values
var YearNS = time.Duration(time.Hour * 24 * 365).Nanoseconds()
YearNS is the number of nanoseconds in a year
Functions ¶
func GetTestSpan ¶
GetTestSpan returns a Span with different fields set
func GetTestTrace ¶
GetTestTrace returns a []Trace that is composed by “traceN“ number of traces, each one composed by “size“ number of spans.
func RandomServices ¶
func RandomServices(maxServices, maxTags int) model.ServicesMetadata
RandomServices generates random services metadata
func RandomSpan ¶
RandomSpan generates a wide-variety of spans, useful to test robustness & performance
func RandomSpanDuration ¶
func RandomSpanDuration() int64
RandomSpanDuration generates a random span duration
func RandomSpanError ¶
func RandomSpanError() int32
RandomSpanError generates a random span error code
func RandomSpanMeta ¶
RandomSpanMeta generates some random span metadata
func RandomSpanMetrics ¶
RandomSpanMetrics generates some random span metrics
func RandomSpanName ¶
func RandomSpanName() string
RandomSpanName generates a random span name string
func RandomSpanParentID ¶
func RandomSpanParentID() uint64
RandomSpanParentID generates a random span parent ID
func RandomSpanResource ¶
func RandomSpanResource() string
RandomSpanResource generates a random span resource string
func RandomSpanService ¶
func RandomSpanService() string
RandomSpanService generates a random span service string
func RandomSpanStart ¶
func RandomSpanStart() int64
RandomSpanStart generates a span start timestamp
func RandomSpanTraceID ¶
func RandomSpanTraceID() uint64
RandomSpanTraceID generates a random trace ID
func RandomStatsBucket ¶
func RandomStatsBucket(n int) model.StatsBucket
RandomStatsBucket returns a bucket made from n random spans, useful to run benchmarks and tests
func RandomTrace ¶
RandomTrace generates a random trace with a depth from 1 to maxLevels of spans. Each level has at most maxSpans items.
func RandomWeightedSpan ¶
func RandomWeightedSpan() *model.WeightedSpan
RandomWeightedSpan generates a random weighted span, useful for stats tests
func StatsBucketWithSpans ¶
func StatsBucketWithSpans(spans []*model.WeightedSpan) model.StatsBucket
StatsBucketWithSpans returns a stats bucket populated with spans stats
func TestDistribution ¶
func TestDistribution() model.Distribution
TestDistribution returns a distribution with pre-defined values
func TestStatsBucket ¶
func TestStatsBucket() model.StatsBucket
TestStatsBucket returns a fixed stats bucket to be used in unit tests
func TestWeightedSpan ¶
func TestWeightedSpan() *model.WeightedSpan
TestWeightedSpan returns a static test weighted span for reproductive stats tests
Types ¶
This section is empty.