Documentation
¶
Index ¶
- Constants
- func SaveConfig(dataDir string, config *GeneratorConfig) error
- type Application
- type Batch
- type Builder
- type ChunkStore
- type DataObjStore
- type DenseInterval
- type Faker
- func (f *Faker) AuthAction() string
- func (f *Faker) AuthError() string
- func (f *Faker) AuthSuccess() bool
- func (f *Faker) CacheError() string
- func (f *Faker) CacheKey() string
- func (f *Faker) CacheOp() string
- func (f *Faker) CacheSize() int
- func (f *Faker) CacheTTL() int
- func (f *Faker) DBError() string
- func (f *Faker) Duration() time.Duration
- func (f *Faker) Error() string
- func (f *Faker) ErrorMessage() string
- func (f *Faker) GRPCMethod() string
- func (f *Faker) GrafanaComponent() string
- func (f *Faker) GrafanaLogger() string
- func (f *Faker) GrafanaMessage() string
- func (f *Faker) Hostname() string
- func (f *Faker) IP() string
- func (f *Faker) K8sComponent() string
- func (f *Faker) K8sLogPrefix() string
- func (f *Faker) K8sMessage() string
- func (f *Faker) KafkaError() string
- func (f *Faker) KafkaEvent() string
- func (f *Faker) KafkaOffset() int
- func (f *Faker) KafkaPartition() int
- func (f *Faker) KafkaTopic() string
- func (f *Faker) Method() string
- func (f *Faker) NginxErrorType() string
- func (f *Faker) NginxPath() string
- func (f *Faker) OrgID() string
- func (f *Faker) PID() int
- func (f *Faker) Path() string
- func (f *Faker) PrometheusComponent() string
- func (f *Faker) PrometheusMessage() string
- func (f *Faker) PrometheusSubcomponent() string
- func (f *Faker) QueryType() string
- func (f *Faker) Referer() string
- func (f *Faker) RowsAffected() int
- func (f *Faker) SpanID() string
- func (f *Faker) Status() int
- func (f *Faker) SyslogPriority(isError bool) int
- func (f *Faker) Table() string
- func (f *Faker) TempoComponent() string
- func (f *Faker) TempoMessage() string
- func (f *Faker) TraceID() string
- func (f *Faker) User() string
- func (f *Faker) UserAgent() string
- type Generator
- type GeneratorConfig
- type LabelConfig
- type LogGenerator
- type OTELAttributes
- type OTELTraceContext
- type Opt
- func (o Opt) WithDenseInterval(start time.Time, duration time.Duration) Opt
- func (o Opt) WithLabelCardinality(clusters, namespaces, services, pods, containers int) Opt
- func (o Opt) WithLabelConfig(cfg LabelConfig) Opt
- func (o Opt) WithNumStreams(n int) Opt
- func (o Opt) WithSeed(seed int64) Opt
- func (o Opt) WithStartTime(t time.Time) Opt
- func (o Opt) WithTimeSpread(d time.Duration) Opt
- type Store
- type StreamMetadata
- type TestCase
Constants ¶
const (
DefaultDataDir = "./data"
)
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶
func SaveConfig(dataDir string, config *GeneratorConfig) error
SaveConfig saves the generator configuration to a file in the data directory
Types ¶
type Application ¶
type Application struct { Name string LogGenerator LogGenerator OTELResource map[string]string // OTEL resource attributes }
Application represents a type of application that generates logs
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder helps construct test datasets using multiple stores
func NewBuilder ¶
NewBuilder creates a new Builder
type ChunkStore ¶
type ChunkStore struct {
// contains filtered or unexported fields
}
func NewChunkStore ¶
func NewChunkStore(dir, tenantID string) (*ChunkStore, error)
func (*ChunkStore) Close ¶
func (s *ChunkStore) Close() error
Close flushes any remaining data and closes resources
type DataObjStore ¶
type DataObjStore struct {
// contains filtered or unexported fields
}
DataObjStore implements Store using the dataobj format
func NewDataObjStore ¶
func NewDataObjStore(dir, tenantID string) (*DataObjStore, error)
NewDataObjStore creates a new DataObjStore
func (*DataObjStore) Close ¶
func (s *DataObjStore) Close() error
Close flushes any remaining data and closes resources
type DenseInterval ¶
DenseInterval represents a period of high log volume
type Faker ¶
type Faker struct {
// contains filtered or unexported fields
}
Faker provides methods to generate fake data consistently
func (*Faker) AuthAction ¶
AuthAction returns a random authentication action
func (*Faker) AuthSuccess ¶
AuthSuccess returns a random authentication success status
func (*Faker) CacheError ¶
CacheError returns a random cache error
func (*Faker) ErrorMessage ¶
ErrorMessage returns a random error message
func (*Faker) GRPCMethod ¶
GRPCMethod returns a random gRPC method
func (*Faker) GrafanaComponent ¶
GrafanaComponent returns a random Grafana component
func (*Faker) GrafanaLogger ¶
GrafanaLogger returns a random Grafana logger
func (*Faker) GrafanaMessage ¶
GrafanaMessage returns a random Grafana message
func (*Faker) K8sComponent ¶
K8sComponent returns a random Kubernetes component
func (*Faker) K8sLogPrefix ¶
K8sLogPrefix returns a random Kubernetes log prefix
func (*Faker) K8sMessage ¶
K8sMessage returns a random Kubernetes message
func (*Faker) KafkaError ¶
KafkaError returns a random Kafka error
func (*Faker) KafkaEvent ¶
KafkaEvent returns a random Kafka event
func (*Faker) KafkaOffset ¶
KafkaOffset returns a random Kafka offset
func (*Faker) KafkaPartition ¶
KafkaPartition returns a random Kafka partition
func (*Faker) KafkaTopic ¶
KafkaTopic returns a random Kafka topic
func (*Faker) NginxErrorType ¶
NginxErrorType returns a random nginx error type
func (*Faker) PrometheusComponent ¶
PrometheusComponent returns a random Prometheus component
func (*Faker) PrometheusMessage ¶
PrometheusMessage returns a random Prometheus message
func (*Faker) PrometheusSubcomponent ¶
PrometheusSubcomponent returns a random Prometheus subcomponent
func (*Faker) RowsAffected ¶
RowsAffected returns a random number of rows affected
func (*Faker) SyslogPriority ¶
SyslogPriority returns a random syslog priority
func (*Faker) TempoComponent ¶
TempoComponent returns a random Tempo component
func (*Faker) TempoMessage ¶
TempoMessage returns a random Tempo message
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator represents a log generator with configuration
func NewGenerator ¶
NewGenerator creates a new generator with the given options
type GeneratorConfig ¶
type GeneratorConfig struct { StartTime time.Time TimeSpread time.Duration // DenseIntervals defines periods of high log density // Each interval will have 10x more logs than normal periods DenseIntervals []DenseInterval LabelConfig LabelConfig NumStreams int // Number of streams to generate per batch Seed int64 // Source of randomness }
GeneratorConfig contains all configuration for the log generator
func LoadConfig ¶
func LoadConfig(dataDir string) (*GeneratorConfig, error)
LoadConfig loads the generator configuration from the data directory
func (*GeneratorConfig) GenerateTestCases ¶
func (c *GeneratorConfig) GenerateTestCases() []TestCase
GenerateTestCases creates a sorted list of test cases using the configuration
func (*GeneratorConfig) NewRand ¶
func (c *GeneratorConfig) NewRand() *rand.Rand
NewRand creates a new random source using the configured seed
type LabelConfig ¶
type LabelConfig struct { Clusters int // 1-10 clusters Namespaces int // 10-100 namespaces Services int // 100-1000 services Pods int // 1000-10000 pods Containers int // 1-5 containers per pod LogLevels []string // Log levels to use EnvTypes []string // Environment types Regions []string // Regions Datacenters []string // Datacenters }
LabelConfig configures the cardinality of generated labels
type LogGenerator ¶
LogGenerator is a function that generates a log line
type OTELAttributes ¶
type OTELAttributes struct { Resource map[string]string // Resource attributes constant for the service Trace *OTELTraceContext // Optional trace context }
OTELAttributes represents OpenTelemetry attributes for logs
type OTELTraceContext ¶
OTELTraceContext represents OpenTelemetry trace context
type Opt ¶
type Opt struct {
// contains filtered or unexported fields
}
Opt represents configuration options for the generator
func (Opt) WithDenseInterval ¶
WithDenseInterval adds a dense interval to the configuration
func (Opt) WithLabelCardinality ¶
WithLabelCardinality configures the cardinality of different labels
func (Opt) WithLabelConfig ¶
func (o Opt) WithLabelConfig(cfg LabelConfig) Opt
WithLabelConfig sets the entire label configuration
func (Opt) WithNumStreams ¶
WithNumStreams sets the number of streams to generate per batch
func (Opt) WithStartTime ¶
WithStartTime sets the start time for log generation
type Store ¶
type Store interface { // Write writes a batch of streams to the store Write(ctx context.Context, streams []logproto.Stream) error // Name returns the name of the store implementation Name() string // Close flushes any remaining data and closes resources Close() error }
Store represents a storage backend for log data
type StreamMetadata ¶
type StreamMetadata struct { Labels string App Application }
StreamMetadata holds the consistent properties of a stream
type TestCase ¶
type TestCase struct { Query string Start time.Time End time.Time Direction logproto.Direction Step time.Duration // Step size for metric queries }
TestCase represents a LogQL test case for benchmarking and testing
func (TestCase) Description ¶
Description returns a detailed description of the test case including time range