pluginmanager

package
v0.0.0-...-805d83d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarksGauge    = "syntheticheart_marks_total"
	MaxMarksGauge = "syntheticheart_max_marks_total"
	TimeGauge     = "syntheticheart_runtime_ns"
	CustomGauge   = "syntheticheart_%s" // Gauge name
)
View Source
const DefaultLabelFilePath string = "/etc/podinfo/labels"
View Source
const PrometheusLabelRegex = "[a-zA-Z_][a-zA-Z0-9_]*"
View Source
const (
	SyntestPrefix = "test-"
)

Variables

View Source
var SynTestCmdMap = map[string][]string{}

SynTestCmdMap is a map of plugin names to plugin commands

View Source
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

func RegisterSynTestPlugin(pluginName string, cmd []string)

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 RunnablePlugin interface {
	Run(ctx context.Context) error
}

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 (sm *StateMap) DeletePluginState(id string)

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 (sm *StateMap) GetAllPluginState() State

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

func (*SynTestRoutine) Run

func (str *SynTestRoutine) Run(ctx context.Context) error

type SyntheticTest

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

Jump to

Keyboard shortcuts

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