Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Faker
- type Generator
- func (g *Generator) Generate() LogEntry
- func (g *Generator) GenerateApplication() LogEntry
- func (g *Generator) GenerateBusiness() LogEntry
- func (g *Generator) GenerateCategory(category string) LogEntry
- func (g *Generator) GenerateChaos() LogEntry
- func (g *Generator) GenerateDatabase() LogEntry
- func (g *Generator) GenerateHTTP() LogEntry
- func (g *Generator) GenerateSecurity() LogEntry
- func (g *Generator) GenerateSystem() LogEntry
- type LogEntry
- type LogHeader
- type Stats
Constants ¶
const ( WeightHTTP = 25 WeightApplication = 25 WeightDatabase = 15 WeightSecurity = 10 WeightSystem = 10 WeightBusiness = 10 WeightChaos = 5 )
Category distribution weights (must sum to 100).
Variables ¶
var SeverityWeightsChaos = map[string]int{
"debug": 5,
"info": 20,
"success": 10,
"warning": 25,
"error": 30,
"critical": 10,
}
Severity distribution weights for chaos mode (must sum to 100).
var SeverityWeightsNormal = map[string]int{
"debug": 10,
"info": 45,
"success": 15,
"warning": 15,
"error": 12,
"critical": 3,
}
Severity distribution weights for normal mode (must sum to 100).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Connection
Endpoint string
// Realistic mode
MinDelay time.Duration
MaxDelay time.Duration
// Limits
Duration time.Duration
Count int
// Modes
Chaos bool
Stress bool
DryRun bool
Quiet bool
Verbose bool
// Stress mode
StressRate int
// Reproducibility
Seed int64
// Filtering
Categories []string
}
Config holds the configuration for the faker.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a config with sensible defaults.
type Faker ¶
type Faker struct {
// contains filtered or unexported fields
}
Faker generates and sends fake logs.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator creates random log entries.
func NewGenerator ¶
NewGenerator creates a new log generator.
func (*Generator) GenerateApplication ¶
GenerateApplication creates an application log.
func (*Generator) GenerateBusiness ¶
GenerateBusiness creates a business log.
func (*Generator) GenerateCategory ¶
GenerateCategory returns a log from a specific category.
func (*Generator) GenerateChaos ¶
GenerateChaos creates unstructured/messy logs.
func (*Generator) GenerateDatabase ¶
GenerateDatabase creates a database log.
func (*Generator) GenerateHTTP ¶
GenerateHTTP creates an HTTP access log.
func (*Generator) GenerateSecurity ¶
GenerateSecurity creates a security log.
func (*Generator) GenerateSystem ¶
GenerateSystem creates a system log.
type LogHeader ¶
type LogHeader struct {
Title string `json:"title"`
Source string `json:"source,omitempty"`
Severity string `json:"severity,omitempty"`
}
LogHeader represents the header of a log entry.
type Stats ¶
type Stats struct {
Sent atomic.Int64
Errors atomic.Int64
StartTime time.Time
// contains filtered or unexported fields
}
Stats tracks faker statistics.
func (*Stats) AddLatency ¶
AddLatency records a request latency.
func (*Stats) Percentile ¶
Percentile returns the nth percentile latency.