Documentation
¶
Index ¶
- Constants
- Variables
- func DiscoverPlugins(config common.PluginDiscoveryConfig) (map[string][]string, error)
- func RegisterSynTestPlugin(pluginName string, cmd []string)
- func StartPlugin(ctx context.Context, pluginId string, pluginName string, plugin RunnablePlugin, ...)
- type ExtStorageHandler
- 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, testConfigId string)
- func (pm *PluginManager) SyncConfig(ctx context.Context) (bool, error)
- func (pm *PluginManager) SyncSyntestPluginConfigs(ctx context.Context) (bool, error)
- 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 SynTestRoutine
- type SyntheticTest
Constants ¶
const ( MarksGauge = "syntheticheart_marks_total" MaxMarksGauge = "syntheticheart_max_marks_total" TimeGauge = "syntheticheart_runtime_ns" CustomGauge = "syntheticheart_%s" // Gauge name )
const DefaultLabelFilePath string = "/etc/podinfo/labels"
const PrometheusLabelRegex = "[a-zA-Z_][a-zA-Z0-9_]*"
const (
SyntestPrefix = "test-"
)
Variables ¶
var SynTestCmdMap = map[string][]string{}
SynTestCmdMap is a map of plugin names to plugin commands
var SynTestNameMap = map[string]plugin.Plugin{}
SynTestNameMap is a map of plugin names to go-plugin objs
Functions ¶
func DiscoverPlugins ¶
func DiscoverPlugins(config common.PluginDiscoveryConfig) (map[string][]string, error)
DiscoverPlugins returns a list of all plugins discovered in the plugin directory
func RegisterSynTestPlugin ¶
RegisterSynTestPlugin registers a plugin with the plugin manager
func StartPlugin ¶
func StartPlugin(ctx context.Context, pluginId string, pluginName string, plugin RunnablePlugin, restartPolicy common.PluginRestartPolicy, sm StateMap)
StartPlugin Starts a plugin and manages the lifecycle (i.e. syntest)
Types ¶
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 common.StorageConfig, logger hclog.Logger) (ExtStorageHandler, error)
func (*ExtStorageHandler) Run ¶
func (esh *ExtStorageHandler) Run(ctx context.Context, broadcaster *utils.Broadcaster, sm *StateMap) error
type PluginManager ¶
type PluginManager struct {
AgentId string
SyntheticTests map[string]SyntheticTest // cache and metadata of synthetictest configs that run on this agent
// 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)
NewPluginManager creates a new plugin manager with given config file path
func (*PluginManager) Exit ¶
func (pm *PluginManager) Exit(err error)
func (*PluginManager) Start ¶
func (pm *PluginManager) Start(ctx context.Context) error
Start starts the Pluginmanager
func (*PluginManager) StartPrometheus ¶
func (pm *PluginManager) StartPrometheus(ctx context.Context, wg *sync.WaitGroup, configChange chan struct{}) context.CancelFunc
StartPrometheus Starts prometheus server, returns a cancel function
func (*PluginManager) StartTestRoutine ¶
func (pm *PluginManager) StartTestRoutine(ctx context.Context, s SyntheticTest)
StartTestRoutine Starts the synthetic test go routine (that manages the plugin process)
func (*PluginManager) StopAndDeleteSynTest ¶
func (pm *PluginManager) StopAndDeleteSynTest(ctx context.Context, testConfigId string)
StopAndDeleteSynTest stops the syntest plugin and deletes data associated with the syntest
func (*PluginManager) SyncConfig ¶
func (pm *PluginManager) SyncConfig(ctx context.Context) (bool, error)
SyncConfig syncs the syntest configs from redis
func (*PluginManager) SyncSyntestPluginConfigs ¶
func (pm *PluginManager) SyncSyntestPluginConfigs(ctx context.Context) (bool, error)
SyncSyntestPluginConfigs checks external storage for new syntest config or change in existing ones and then start/stops appropriate plugins
type PrometheusExporter ¶
type PrometheusExporter struct {
// contains filtered or unexported fields
}
func NewPrometheusExporter ¶
func NewPrometheusExporter(logger hclog.Logger, agentConfig common.AgentConfig, agentId string, debugMode bool) (PrometheusExporter, error)
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, agentConfig common.AgentConfig) StateMap
func (*StateMap) DeletePluginState ¶
func (*StateMap) GetAgentStatus ¶
func (sm *StateMap) GetAgentStatus() common.AgentStatus
GetAgentStatus returns the state the agent is in including the status of all the plugins, as well as the agent config
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 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
}