generator

package
v0.0.0-...-f54f16c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneratorCfg

type GeneratorCfg struct {
	Supervisors []SupervisorCfg `toml:"supervisor"`
}

generator

[[generator.supervisor]]
  # SupervisorCfg one
[[generator.supervisor]]
  # SupervisorCfg two

type LoadGenRunner

type LoadGenRunner struct {
	SupervisorGroups SupervisorGroupCollection
	// contains filtered or unexported fields
}

func (*LoadGenRunner) Run

func (r *LoadGenRunner) Run(cfg *RunnerConfig)

type LoadProfileCfg

type LoadProfileCfg struct {
	Templates    Templates    `toml:"templates"`
	GeneratorCfg GeneratorCfg `toml:"generator"`
}

func BuiltinConfig

func BuiltinConfig() (*LoadProfileCfg, error)

func BuiltinConfigFull

func BuiltinConfigFull() (*LoadProfileCfg, error)

func ProfileFromFile

func ProfileFromFile(path string) (*LoadProfileCfg, error)

func (*LoadProfileCfg) BuildRunner

func (l *LoadProfileCfg) BuildRunner() (*LoadGenRunner, error)

func (*LoadProfileCfg) BuildSupervisorGroups

func (l *LoadProfileCfg) BuildSupervisorGroups() (SupervisorGroupCollection, error)

type MessagePrototype

type MessagePrototype struct {
	Application string
	Environment string
	Channel     string
	Site        string
	Origin      string
	PkgName     string
	Release     string
}

Data elements of a message that currently exist: sup-id AUTO group hardcode to "default" application assign per-service in sup template environment <name> The environment name of the current deployment health hardcode to 0 (OK) for now. status hardcode to 0 (RUNNING) for now

Package Identifier --origin parse from service name --name parse from service name --version hardcode to 1.0.0 for now --release generate from the startup time of the generator

func (*MessagePrototype) ApplySupCfg

func (m *MessagePrototype) ApplySupCfg(s SupervisorCfg)

func (*MessagePrototype) ApplySvcTemplate

func (m *MessagePrototype) ApplySvcTemplate(t ServiceTemplate) error

func (*MessagePrototype) CreateMessage

func (m *MessagePrototype) CreateMessage(uuid string) *habitat.HealthCheckEvent

func (*MessagePrototype) PkgFQID

func (m *MessagePrototype) PkgFQID() string

func (*MessagePrototype) PrettyStr

func (m *MessagePrototype) PrettyStr() string

func (*MessagePrototype) SetRelease

func (m *MessagePrototype) SetRelease()

type RunnerConfig

type RunnerConfig struct {
	AuthToken string
	Host      string
	Tick      int
	Verbosity int
}

type RunnerStats

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

func (*RunnerStats) TotalMessages

func (r *RunnerStats) TotalMessages() uint64

func (*RunnerStats) TotalRate

func (r *RunnerStats) TotalRate() float64

type RunnerStatsKeeper

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

func NewStatsKeeper

func NewStatsKeeper() *RunnerStatsKeeper

func (*RunnerStatsKeeper) FailedPublish

func (r *RunnerStatsKeeper) FailedPublish()

func (*RunnerStatsKeeper) Interval

func (r *RunnerStatsKeeper) Interval() time.Duration

func (*RunnerStatsKeeper) Report

func (r *RunnerStatsKeeper) Report()

func (*RunnerStatsKeeper) ResetCycleStats

func (r *RunnerStatsKeeper) ResetCycleStats()

func (*RunnerStatsKeeper) RunCollectAndPrintLoop

func (r *RunnerStatsKeeper) RunCollectAndPrintLoop()

func (*RunnerStatsKeeper) SuccessfulPublish

func (r *RunnerStatsKeeper) SuccessfulPublish()

func (*RunnerStatsKeeper) SupDied

func (r *RunnerStatsKeeper) SupDied()

func (*RunnerStatsKeeper) SupStarted

func (r *RunnerStatsKeeper) SupStarted()

type ServiceTemplate

type ServiceTemplate struct {
	Package     string `toml:"package"`
	Application string `toml:"application"`
}

[[ service ]] package = "noms/pos-service-2"

type SiteRange

type SiteRange struct {
	FormatStr string `toml:"format"`
	Count     int32  `toml:"count"`
}

[site_range]

format = "restaurant-prod1-%s"
count = 1000

type SupSim

type SupSim struct {
	Name              string
	Idx               int32
	Cfg               *RunnerConfig
	UUID              uuid.UUID
	MessagePrototypes []*MessagePrototype
	Stats             *RunnerStatsKeeper
	// contains filtered or unexported fields
}

func (*SupSim) Connect

func (s *SupSim) Connect() error

func (*SupSim) PublishAll

func (s *SupSim) PublishAll() error

func (*SupSim) Run

func (s *SupSim) Run()

type SupervisorCfg

type SupervisorCfg struct {
	Name         string `toml:"name"`
	TemplateName string `toml:"template"`
	Count        int32  `toml:"count"`
	Channel      string `toml:"channel"`
	Environment  string `toml:"environment"`
	Site         string `toml:"site"`
}

[[generator.supervisor]]

name = "pos_terminals:production1"
template = "pos_terminal"
count = 1000
channel = "production1"
[site_range]
  format = "restaurant-prod1-%s"
  count = 1000

type SupervisorGroup

type SupervisorGroup struct {
	Name              string
	Count             int32
	MessagePrototypes []*MessagePrototype
}

func (*SupervisorGroup) NewSup

func (s *SupervisorGroup) NewSup(n int32, cfg *RunnerConfig, stats *RunnerStatsKeeper) (*SupSim, error)

func (*SupervisorGroup) PrettyStr

func (s *SupervisorGroup) PrettyStr() string

func (*SupervisorGroup) Run

func (s *SupervisorGroup) Run(cfg *RunnerConfig, stats *RunnerStatsKeeper)

type SupervisorGroupCollection

type SupervisorGroupCollection []*SupervisorGroup

func (SupervisorGroupCollection) HealthCheckRate

func (s SupervisorGroupCollection) HealthCheckRate() float64

Have to assume a default RunnerConfig.Tick of 30s here.

func (SupervisorGroupCollection) ReScaleTo

func (s SupervisorGroupCollection) ReScaleTo(svcCount int32)

func (SupervisorGroupCollection) RollupStats

func (s SupervisorGroupCollection) RollupStats() string

func (SupervisorGroupCollection) TotalSups

func (s SupervisorGroupCollection) TotalSups() int32

func (SupervisorGroupCollection) TotalSvcs

func (s SupervisorGroupCollection) TotalSvcs() int32

type SupervisorTemplate

type SupervisorTemplate struct {
	Name             string            `toml:"name"`
	ServiceTemplates []ServiceTemplate `toml:"service"`
}

name = "pos_terminal" [[ service ]] package = "noms/pos-service-1" [[ service ]] package = "noms/pos-service-2"

type Templates

type Templates struct {
	SupervisorTemplates []SupervisorTemplate `toml:"supervisor"`
}

[templates]

[[templates.supervisor]]
  # SupervisorTemplate one
[[templates.supervisor]]
  # SupervisorTemplate two

func (Templates) GetTemplate

func (ts Templates) GetTemplate(name string) *SupervisorTemplate

Jump to

Keyboard shortcuts

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