Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterSynTestPlugin(pluginName string, cmd []string)
- func StartPlugin(ctx context.Context, pluginId string, pluginName string, plugin RunnablePlugin, ...)
- type Config
- type ExtStorageHandler
- func (esh *ExtStorageHandler) ReSyncTestRun(ctx context.Context, b *utils.Broadcaster) error
- func (esh *ExtStorageHandler) RegisterTestToImport(testName string)
- func (esh *ExtStorageHandler) Run(ctx context.Context, broadcaster *utils.Broadcaster, sm *StateMap) error
- func (esh *ExtStorageHandler) UnregisterTestToImport(testName string)
- type PluginManager
- func (pm *PluginManager) Exit(err error)
- func (pm *PluginManager) Start(ctx context.Context) error
- func (pm *PluginManager) StartPrometheus(ctx context.Context, wg *sync.WaitGroup, configChange chan struct{}) context.CancelFunc
- func (pm *PluginManager) StartTestRoutine(ctx context.Context, s SyntheticTest)
- func (pm *PluginManager) StopAndDeleteSynTest(ctx context.Context, testName string)
- func (pm *PluginManager) SyncConfig(ctx context.Context) (bool, error)
- func (pm *PluginManager) SyncSyntestPluginConfigs(ctx context.Context) (bool, error)
- type PrintPluginLogOption
- type PrometheusConfig
- type PrometheusExporter
- type RunnablePlugin
- type State
- type StateMap
- func (sm *StateMap) DeletePluginState(id string)
- func (sm *StateMap) GetAgentStatus() common.AgentStatus
- func (sm *StateMap) GetAllPluginState() State
- func (sm *StateMap) GetPluginState(id string) (common.PluginState, error)
- func (sm *StateMap) SetPluginState(id string, state common.PluginState)
- func (sm *StateMap) SetPluginStatus(id string, status common.RoutineStatus)
- type StorageConfig
- type SynTestRoutine
- type SyntheticTest
Constants ¶
const ( BinPath = "./plugins/" SyntestPrefix = "test-" )
const ( MarksGauge = "syntheticheart_marks_total" MaxMarksGauge = "syntheticheart_max_marks_total" TimeGauge = "syntheticheart_runtime_ns" CustomGauge = "syntheticheart_%s" // Gauge name )
Variables ¶
var SynTestCmdMap = map[string][]string{}
var SynTestNameMap = map[string]plugin.Plugin{}
Functions ¶
func RegisterSynTestPlugin ¶
func StartPlugin ¶
func StartPlugin(ctx context.Context, pluginId string, pluginName string, plugin RunnablePlugin, restartPolicy common.PluginRestartPolicy, sm StateMap)
Starts a plugin and manages the lifecycle (i.e. syntest)
Types ¶
type Config ¶
type Config struct { NodeName string `yaml:"nodeName"` SyncFrequency time.Duration `yaml:"syncFrequency"` GracePeriod time.Duration `yaml:"gracePeriod"` PrometheusConfig PrometheusConfig `yaml:"prometheus"` StoreConfig StorageConfig `yaml:"storage"` PrintPluginLogs PrintPluginLogOption `yaml:"printPluginLogs"` Etc map[string]string `yaml:"etc"` DebugMode bool `yaml:"debugMode"` }
type ExtStorageHandler ¶
type ExtStorageHandler struct { Store storage.SynHeartStore // contains filtered or unexported fields }
ExtStorageHandler manages all communication with external storage (redis)
func NewExtStorageHandler ¶
func NewExtStorageHandler(agentId string, config StorageConfig, logger hclog.Logger) (ExtStorageHandler, error)
func (*ExtStorageHandler) ReSyncTestRun ¶
func (esh *ExtStorageHandler) ReSyncTestRun(ctx context.Context, b *utils.Broadcaster) error
func (*ExtStorageHandler) RegisterTestToImport ¶
func (esh *ExtStorageHandler) RegisterTestToImport(testName string)
func (*ExtStorageHandler) Run ¶
func (esh *ExtStorageHandler) Run(ctx context.Context, broadcaster *utils.Broadcaster, sm *StateMap) error
func (*ExtStorageHandler) UnregisterTestToImport ¶
func (esh *ExtStorageHandler) UnregisterTestToImport(testName string)
type PluginManager ¶
type PluginManager struct { AgentId string SyntheticTests map[string]SyntheticTest // contains filtered or unexported fields }
PluginManager manages all the different plugins It manages the lifecycle and the communication between them
func NewPluginManager ¶
func NewPluginManager(configPath string) (*PluginManager, error)
Creates a new plugin manager
func (*PluginManager) Exit ¶
func (pm *PluginManager) Exit(err error)
func (*PluginManager) StartPrometheus ¶
func (pm *PluginManager) StartPrometheus(ctx context.Context, wg *sync.WaitGroup, configChange chan struct{}) context.CancelFunc
Starts prometheus server, returns a cancel function
func (*PluginManager) StartTestRoutine ¶
func (pm *PluginManager) StartTestRoutine(ctx context.Context, s SyntheticTest)
Starts the synthetic test go routine (that manages the plugin)
func (*PluginManager) StopAndDeleteSynTest ¶
func (pm *PluginManager) StopAndDeleteSynTest(ctx context.Context, testName string)
func (*PluginManager) SyncConfig ¶
func (pm *PluginManager) SyncConfig(ctx context.Context) (bool, error)
func (*PluginManager) SyncSyntestPluginConfigs ¶
func (pm *PluginManager) SyncSyntestPluginConfigs(ctx context.Context) (bool, error)
checks external storage for new syntest config or change in existing ones and then start/stops appropriate plugins
type PrintPluginLogOption ¶
type PrintPluginLogOption string
const ( LogOnFail PrintPluginLogOption = "onFail" LogNever PrintPluginLogOption = "never" LogAlways PrintPluginLogOption = "always" )
type PrometheusConfig ¶
type PrometheusExporter ¶
type PrometheusExporter struct {
// contains filtered or unexported fields
}
func NewPrometheusExporter ¶
func NewPrometheusExporter(logger hclog.Logger, config PrometheusConfig, agentId string, debugMode bool) PrometheusExporter
func (*PrometheusExporter) Cleanup ¶
func (p *PrometheusExporter) Cleanup()
func (*PrometheusExporter) ExportTestRunMetrics ¶
func (p *PrometheusExporter) ExportTestRunMetrics(res proto.TestRun) error
func (*PrometheusExporter) Run ¶
func (p *PrometheusExporter) Run(ctx context.Context, broadcaster *utils.Broadcaster, configChange chan struct{})
type RunnablePlugin ¶
type State ¶
type State struct {
PluginStates map[string]common.PluginState `json:"plugins"`
}
type StateMap ¶
type StateMap struct {
// contains filtered or unexported fields
}
Stores Plugin State (i.e. whether they are running, no. of restarts etc.)
func NewStateMap ¶
func NewStateMap(logger hclog.Logger) StateMap
func (*StateMap) DeletePluginState ¶
func (*StateMap) GetAgentStatus ¶
func (sm *StateMap) GetAgentStatus() common.AgentStatus
returns list of plugins that its meant to run
func (*StateMap) GetAllPluginState ¶
func (*StateMap) GetPluginState ¶
func (sm *StateMap) GetPluginState(id string) (common.PluginState, error)
func (*StateMap) SetPluginState ¶
func (sm *StateMap) SetPluginState(id string, state common.PluginState)
func (*StateMap) SetPluginStatus ¶
func (sm *StateMap) SetPluginStatus(id string, status common.RoutineStatus)
type StorageConfig ¶
type SynTestRoutine ¶
type SynTestRoutine struct {
// contains filtered or unexported fields
}
SynTestRoutine handles communication between the synthetic heart binary and a synthetic test plugin
type SyntheticTest ¶
type SyntheticTest struct {
// contains filtered or unexported fields
}