datagen

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package datagen is a basic framework for generating fake telemetry data for benchmarking.

Index

Constants

This section is empty.

Variables

View Source
var EventNames = []string{"empty", "dns-lookup", "tcp-connect", "tcp-handshake", "tcp-send", "tcp-receive", "tcp-close", "http-send", "http-receive", "http-close", "message-send", "message-receive", "message-close", "grpc-send", "grpc-receive", "grpc-close", "grpc-status", "grpc-trailers", "unknown"}
View Source
var GroupIds = []string{"group1", "group2", "group3", "group4", "group5"}
View Source
var HOSTNAMES = []string{"host1.mydomain.com", "host2.org", "host3.thedomain.edu", "host4.gov", "host5.retailer.com"}
View Source
var STATUS = []int64{200, 300, 400, 404, 500, 503}
View Source
var TraceStates = []string{"started", "ended", "unknown"}
View Source
var UPS = []bool{true, false}
View Source
var VERSIONS = []string{"1.0.0", "1.0.2", "2.0", "1.9.9"}

Functions

This section is empty.

Types

type AttrFunc

type AttrFunc func(Attrs)

type Attrs

type Attrs = pcommon.Map

type Config

type Config struct {
	// Probability of generating a metric description
	ProbMetricDescription float64
	// Probability of generating a metric unit
	ProbMetricUnit float64
	// Probability of generating a metric histogram with a sum
	ProbHistogramHasSum float64
	// Probability of generating a metric histogram with a min
	ProbHistogramHasMin float64
	// Probability of generating a metric histogram with a max
	ProbHistogramHasMax float64
}

func NewDefaultConfig

func NewDefaultConfig() Config

type DataGenerator

type DataGenerator struct {
	TestEntropy
	// contains filtered or unexported fields
}

func NewDataGenerator

func NewDataGenerator(entropy TestEntropy, resourceAttributes []pcommon.Map, instrumentationScopes []pcommon.InstrumentationScope) *DataGenerator

func (*DataGenerator) AddRandomSpansTo

func (dg *DataGenerator) AddRandomSpansTo(spans ptrace.SpanSlice)

func (*DataGenerator) AdvanceTime

func (dg *DataGenerator) AdvanceTime(timeDelta time.Duration)

func (*DataGenerator) CurrentTime

func (dg *DataGenerator) CurrentTime() pcommon.Timestamp

func (*DataGenerator) EmptyGaugeMetric

func (dg *DataGenerator) EmptyGaugeMetric(metric pmetric.Metric)

func (*DataGenerator) EmptyMetric

func (dg *DataGenerator) EmptyMetric(metric pmetric.Metric)

func (*DataGenerator) EmptySumMetric

func (dg *DataGenerator) EmptySumMetric(metric pmetric.Metric)

func (*DataGenerator) EmptySummaryMetric

func (dg *DataGenerator) EmptySummaryMetric(metric pmetric.Metric)

func (*DataGenerator) ExpHistogramWithEverything

func (dg *DataGenerator) ExpHistogramWithEverything(metric pmetric.Metric)

ExpHistogramWithEverything generates a fake exponential histogram metric. All field are purposely filled with random values.

func (*DataGenerator) ExpHistogramWithNoDataPoints

func (dg *DataGenerator) ExpHistogramWithNoDataPoints(metric pmetric.Metric)

func (*DataGenerator) ExpHistogramWithOnlyExemplars

func (dg *DataGenerator) ExpHistogramWithOnlyExemplars(metric pmetric.Metric)

func (*DataGenerator) ExpHistogramWithOnlyTimestamps

func (dg *DataGenerator) ExpHistogramWithOnlyTimestamps(metric pmetric.Metric)

func (*DataGenerator) ExpHistogramWithoutAttrs

func (dg *DataGenerator) ExpHistogramWithoutAttrs(metric pmetric.Metric)

func (*DataGenerator) ExpHistogramWithoutAttrsAndWithoutBuckets

func (dg *DataGenerator) ExpHistogramWithoutAttrsAndWithoutBuckets(metric pmetric.Metric)

func (*DataGenerator) FakeHistogram

func (dg *DataGenerator) FakeHistogram(metric pmetric.Metric)

FakeHistogram generates a fake histogram metric. All field are purposely filled with random values.

func (*DataGenerator) FakeSummary

func (dg *DataGenerator) FakeSummary(metric pmetric.Metric)

func (*DataGenerator) GaugeEmptyDataPoint

func (dg *DataGenerator) GaugeEmptyDataPoint(metric pmetric.Metric)

func (*DataGenerator) GaugeWithExemplars

func (dg *DataGenerator) GaugeWithExemplars(metric pmetric.Metric)

func (*DataGenerator) GaugeWithoutAttribute

func (dg *DataGenerator) GaugeWithoutAttribute(metric pmetric.Metric)

func (*DataGenerator) GaugeWithoutValue

func (dg *DataGenerator) GaugeWithoutValue(metric pmetric.Metric)

func (*DataGenerator) GenBool

func (dg *DataGenerator) GenBool() bool

func (*DataGenerator) GenF64Range

func (dg *DataGenerator) GenF64Range(min float64, max float64) float64

func (*DataGenerator) GenI64Range

func (dg *DataGenerator) GenI64Range(min int64, max int64) int64

func (*DataGenerator) HasHistogramMax

func (dg *DataGenerator) HasHistogramMax() bool

func (*DataGenerator) HasHistogramMin

func (dg *DataGenerator) HasHistogramMin() bool

func (*DataGenerator) HasHistogramSum

func (dg *DataGenerator) HasHistogramSum() bool

func (*DataGenerator) HasMetricDescription

func (dg *DataGenerator) HasMetricDescription() bool

func (*DataGenerator) HasMetricUnit

func (dg *DataGenerator) HasMetricUnit() bool

func (*DataGenerator) HistogramWithEverything

func (dg *DataGenerator) HistogramWithEverything(metric pmetric.Metric)

HistogramWithEverything generates a fake histogram metric. All field are purposely filled with random values.

func (*DataGenerator) HistogramWithNoDataPoints

func (dg *DataGenerator) HistogramWithNoDataPoints(metric pmetric.Metric)

func (*DataGenerator) HistogramWithOnlyExemplars

func (dg *DataGenerator) HistogramWithOnlyExemplars(metric pmetric.Metric)

func (*DataGenerator) HistogramWithOnlyTimestamps

func (dg *DataGenerator) HistogramWithOnlyTimestamps(metric pmetric.Metric)

func (*DataGenerator) HistogramWithoutAttrs

func (dg *DataGenerator) HistogramWithoutAttrs(metric pmetric.Metric)

func (*DataGenerator) HistogramWithoutAttrsAndWithoutBuckets

func (dg *DataGenerator) HistogramWithoutAttrsAndWithoutBuckets(metric pmetric.Metric)

func (*DataGenerator) Id16Bytes

func (dg *DataGenerator) Id16Bytes() pcommon.TraceID

func (*DataGenerator) Id8Bytes

func (dg *DataGenerator) Id8Bytes() pcommon.SpanID

func (*DataGenerator) LogDebugRecord

func (dg *DataGenerator) LogDebugRecord(log plog.LogRecord)

func (*DataGenerator) LogErrorRecord

func (dg *DataGenerator) LogErrorRecord(log plog.LogRecord)

func (*DataGenerator) LogInfoComplexRecord

func (dg *DataGenerator) LogInfoComplexRecord(log plog.LogRecord)

func (*DataGenerator) LogInfoRecord

func (dg *DataGenerator) LogInfoRecord(log plog.LogRecord)

func (*DataGenerator) LogWarnRecord

func (dg *DataGenerator) LogWarnRecord(log plog.LogRecord)

func (*DataGenerator) NextId16Bytes

func (dg *DataGenerator) NextId16Bytes()

func (*DataGenerator) NextId8Bytes

func (dg *DataGenerator) NextId8Bytes()

func (*DataGenerator) PrevTime

func (dg *DataGenerator) PrevTime() pcommon.Timestamp

func (*DataGenerator) RandomBody

func (dg *DataGenerator) RandomBody(body pcommon.Value)

func (*DataGenerator) RandomEvents

func (dg *DataGenerator) RandomEvents(ses ptrace.SpanEventSlice)
func (dg *DataGenerator) RandomLinks(sls ptrace.SpanLinkSlice, traceID pcommon.TraceID, spanID pcommon.SpanID)

func (*DataGenerator) RandomLogRecord

func (dg *DataGenerator) RandomLogRecord(log plog.LogRecord)

RandomLogRecord generates a random log record. The list of fields set is random. The value of these fields is also random.

func (*DataGenerator) Spans

func (dg *DataGenerator) Spans(spans ptrace.SpanSlice)

func (*DataGenerator) SumEmptyDataPoint

func (dg *DataGenerator) SumEmptyDataPoint(metric pmetric.Metric)

func (*DataGenerator) SumWithExemplars

func (dg *DataGenerator) SumWithExemplars(metric pmetric.Metric)

func (*DataGenerator) SumWithoutAttribute

func (dg *DataGenerator) SumWithoutAttribute(metric pmetric.Metric)

func (*DataGenerator) SumWithoutValue

func (dg *DataGenerator) SumWithoutValue(metric pmetric.Metric)

func (*DataGenerator) SummaryEmptyDataPoint

func (dg *DataGenerator) SummaryEmptyDataPoint(metric pmetric.Metric)

func (*DataGenerator) SummaryWithoutAttributeAndQuantile

func (dg *DataGenerator) SummaryWithoutAttributeAndQuantile(metric pmetric.Metric)

func (*DataGenerator) SummaryWithoutValue

func (dg *DataGenerator) SummaryWithoutValue(metric pmetric.Metric)

func (*DataGenerator) SystemCpuLoadAverage1m

func (dg *DataGenerator) SystemCpuLoadAverage1m(metric pmetric.Metric)

func (*DataGenerator) SystemCpuTime

func (dg *DataGenerator) SystemCpuTime(metric pmetric.Metric, cpuCount int)

func (*DataGenerator) SystemMemoryUsage

func (dg *DataGenerator) SystemMemoryUsage(metric pmetric.Metric)

func (*DataGenerator) WithConfig

func (dg *DataGenerator) WithConfig(config Config) *DataGenerator

type LogsGenerator

type LogsGenerator struct {
	*DataGenerator
	// contains filtered or unexported fields
}

func NewLogsGenerator

func NewLogsGenerator(entropy TestEntropy, resourceAttributes []pcommon.Map, instrumentationScopes []pcommon.InstrumentationScope) *LogsGenerator

func (*LogsGenerator) Generate

func (lg *LogsGenerator) Generate(batchSize int, collectInterval time.Duration) plog.Logs

type MetricsGenerator

type MetricsGenerator struct {
	*DataGenerator
	// contains filtered or unexported fields
}

func NewMetricsGenerator

func NewMetricsGenerator(entropy TestEntropy, resourceAttributes []pcommon.Map, instrumentationScopes []pcommon.InstrumentationScope) *MetricsGenerator

func NewMetricsGeneratorFromEntropy

func NewMetricsGeneratorFromEntropy(entropy TestEntropy) *MetricsGenerator

func NewMetricsGeneratorWithDataGenerator

func NewMetricsGeneratorWithDataGenerator(dataGenerator *DataGenerator) *MetricsGenerator

func (*MetricsGenerator) GenerateAllKindOfMetrics

func (mg *MetricsGenerator) GenerateAllKindOfMetrics(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateExponentialHistograms

func (mg *MetricsGenerator) GenerateExponentialHistograms(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateGauges

func (mg *MetricsGenerator) GenerateGauges(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateHistograms

func (mg *MetricsGenerator) GenerateHistograms(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateMetricSlice

func (mg *MetricsGenerator) GenerateMetricSlice(batchSize int, collectInterval time.Duration) pmetric.MetricSlice

func (*MetricsGenerator) GenerateRandomMetrics

func (mg *MetricsGenerator) GenerateRandomMetrics(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateSummaries

func (mg *MetricsGenerator) GenerateSummaries(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateSums

func (mg *MetricsGenerator) GenerateSums(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateSystemCpuLoadAverage1m

func (mg *MetricsGenerator) GenerateSystemCpuLoadAverage1m(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateSystemCpuTime

func (mg *MetricsGenerator) GenerateSystemCpuTime(batchSize int, collectInterval time.Duration) pmetric.Metrics

func (*MetricsGenerator) GenerateSystemMemoryUsage

func (mg *MetricsGenerator) GenerateSystemMemoryUsage(batchSize int, collectInterval time.Duration) pmetric.Metrics

type Span

type Span = ptrace.Span

type TestEntropy

type TestEntropy struct {
	// contains filtered or unexported fields
}

func NewTestEntropy

func NewTestEntropy(seed int64) TestEntropy

func (TestEntropy) GenId

func (te TestEntropy) GenId(size uint) []byte

func (TestEntropy) NewRandomInstrumentationScopes

func (te TestEntropy) NewRandomInstrumentationScopes(count int) []pcommon.InstrumentationScope

func (TestEntropy) NewRandomResourceAttributes

func (te TestEntropy) NewRandomResourceAttributes(count int) []pcommon.Map

func (TestEntropy) NewSingleInstrumentationScopes

func (te TestEntropy) NewSingleInstrumentationScopes() []pcommon.InstrumentationScope

func (TestEntropy) NewSingleResourceAttributes

func (te TestEntropy) NewSingleResourceAttributes() []pcommon.Map

func (TestEntropy) NewStandardAttributes

func (te TestEntropy) NewStandardAttributes() pcommon.Map

func (TestEntropy) NewStandardInstrumentationScopes

func (te TestEntropy) NewStandardInstrumentationScopes() []pcommon.InstrumentationScope

func (TestEntropy) NewStandardResourceAttributes

func (te TestEntropy) NewStandardResourceAttributes() []pcommon.Map

func (TestEntropy) NewStandardSpanEventAttributes

func (te TestEntropy) NewStandardSpanEventAttributes() pcommon.Map

func (TestEntropy) NewStandardSpanLinkAttributes

func (te TestEntropy) NewStandardSpanLinkAttributes() pcommon.Map

func (TestEntropy) RandomAttributes

func (te TestEntropy) RandomAttributes() pcommon.Map

RandomAttributes returns a random set of attributes. The number of attributes is random [0,10). The type and value of each attribute is also random.

func (TestEntropy) Start

func (te TestEntropy) Start() int64

type TraceGenerator

type TraceGenerator struct {
	*DataGenerator
}

func NewTracesGenerator

func NewTracesGenerator(entropy TestEntropy, resourceAttributes []pcommon.Map, instrumentationScopes []pcommon.InstrumentationScope) *TraceGenerator

func (*TraceGenerator) Generate

func (tg *TraceGenerator) Generate(batchSize int, collectInterval time.Duration) ptrace.Traces

func (*TraceGenerator) GenerateRandomTraces

func (tg *TraceGenerator) GenerateRandomTraces(batchSize int, collectInterval time.Duration) ptrace.Traces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL