Documentation ¶
Index ¶
- Constants
- Variables
- func AddPrometheusMetricsToResults(promMetric PrometheusMetrics, testResult proto.TestResult) error
- func ComputePluginId(agentId string, testName string) string
- func FailedTestResult() proto.TestResult
- func GetAllActiveClusters(domain string) ([]string, error)
- func GetKafkaHeartBeatTag(clusterName string, clusterDomain string) string
- func GetPluginIdComponents(pluginId string) (agentId string, testName string, err error)
- func ParseYMLConfig(configStr string, o interface{}) error
- type AgentStatus
- type ChronySource
- type KafkaHeartBeat
- type PluginRestartPolicy
- type PluginState
- type PrometheusGauge
- type PrometheusMetrics
- type RoutineStatus
- type SynTestGRPCPlugin
- type SynTestPlugin
- type SynTestPluginGRPCClient
- type SynTestPluginGRPCServer
- func (s *SynTestPluginGRPCServer) Finish(context.Context, *proto.Empty) (*proto.Empty, error)
- func (s *SynTestPluginGRPCServer) Initialise(ctx context.Context, config *proto.SynTestConfig) (*proto.Empty, error)
- func (s *SynTestPluginGRPCServer) PerformTest(ctx context.Context, trigger *proto.Trigger) (*proto.TestResult, error)
- type TestDetailsLogger
- type TestRunStatus
Constants ¶
const ( DnsTestName = "dns" SelfTestRxTestName = "selfTestRx" HttpPingTestName = "httpPing" PingTestName = "ping" NetDialTestName = "netDial" CurlTestName = "curl" )
Test plugin names
const ( TimeFormat = "2006-01-02T15:04:05.999999999Z07:00" BroadcasterPublishChannelSize = 1000 DefaultSynTestSubChannelSize = 1000 DefaultChannelSize = 1000 MaxSynTestTimerJitter = 10000 // milliseconds MaxConfigTimerJitter = 5000 // milliseconds DefaultInitTimeout = 10 * time.Second DefaultRunTimeout = 10 * time.Second DefaultFinishTimeout = 10 * time.Second DefaultLogWaitTime = 15 * time.Millisecond DefaultRestartPolicy = RestartAlways )
const ( TriggerTypeTimer = "timer" TriggerTypeTest = "test" )
Trigger Type Values
const ( ImportanceCritical = "critical" ImportanceHigh = "high" ImportanceMedium = "medium" ImportanceLow = "low" )
Importance Values
const ( ErrorKey = "_error" // special key for error details LogKey = "_log" // special key for logs PrometheusKey = "_prometheus" // special key for prometheus metrics )
Special Keys in Details of TestDetailsMap
const ActiveClusterStatus = 1
const (
DroppedTestResults = "dropped_test_results" // How many test results the broadcaster has dropped because the listener wasn't ready
)
Synthetic Heart Metric Names
Variables ¶
var DefaultBackoff = wait.Backoff{ Steps: 20, Duration: 10 * time.Millisecond, Factor: 3.0, Jitter: 0.1, Cap: 15 * time.Second, }
var DefaultTestPluginHandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "SYNTEST_PLUGIN",
MagicCookieValue: "synthetic-heart",
}
Handshake config for Hashicorp plugins to talk to syntest plugins
Functions ¶
func AddPrometheusMetricsToResults ¶
func AddPrometheusMetricsToResults(promMetric PrometheusMetrics, testResult proto.TestResult) error
Adds a prometheus metric to a test result
func ComputePluginId ¶
Computes plugin id: Plugin Id is just a string representing the agentId (i.e. node) & the test name
func GetAllActiveClusters ¶
Get all active cluster names in target cloud by query cluster status DNS SRV record
func GetKafkaHeartBeatTag ¶
Computes the tag for heartbeat send to LMA (used by LMA tests)
func GetPluginIdComponents ¶
Splits the plugin Id into its agent Id and test name
func ParseYMLConfig ¶
Parses a yaml config
Types ¶
type AgentStatus ¶
type ChronySource ¶
type KafkaHeartBeat ¶
type PluginRestartPolicy ¶
type PluginRestartPolicy string
PluginRestartPolicy Values
const ( RestartAlways PluginRestartPolicy = "always" RestartNever PluginRestartPolicy = "never" RestartOnError PluginRestartPolicy = "onError" )
type PluginState ¶
type PluginState struct { Status RoutineStatus `json:"status" yaml:"status"` StatusMsg string `json:"statusMsg" yaml:"statusMsg"` LastMsg string `json:"lastMsg" yaml:"lastMsg"` Config interface{} `json:"config" yaml:"config"` Restarts int `json:"restarts" yaml:"restarts"` TotalRestarts int `json:"totalRestarts" yaml:"totalRestarts"` RunningSince time.Time `json:"runningSince" yaml:"runningSince"` LastUpdated time.Time `json:"lastUpdated" yaml:"lastUpdated"` }
type PrometheusGauge ¶
type PrometheusMetrics ¶
type PrometheusMetrics struct {
Gauges []PrometheusGauge `yaml:"gauges"`
}
type RoutineStatus ¶
type RoutineStatus string
const ( NotRunning RoutineStatus = "notRunning" Running RoutineStatus = "running" Error RoutineStatus = "error" RestartBackOff RoutineStatus = "restartBackOff" Restarting RoutineStatus = "restarting" StatusUnknown RoutineStatus = "unknown" )
type SynTestGRPCPlugin ¶
type SynTestGRPCPlugin struct { plugin.Plugin // Implement the plugin.Plugin Interface even tho its a GRPC interface (necessary) Impl SynTestPlugin // The real implementation is injected into this variable }
func (SynTestGRPCPlugin) GRPCClient ¶
func (SynTestGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*SynTestGRPCPlugin) GRPCServer ¶
func (p *SynTestGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type SynTestPlugin ¶
type SynTestPlugin interface { // Called once at the start when plugin is run Initialise(config proto.SynTestConfig) error // Called when the test needs to be performed. PerformTest(info proto.Trigger) (proto.TestResult, error) // Called once at the end, before the plugin is killed Finish() error }
INTERFACES
The interface all test plugins must implement
type SynTestPluginGRPCClient ¶
type SynTestPluginGRPCClient struct {
// contains filtered or unexported fields
}
func (*SynTestPluginGRPCClient) Finish ¶
func (t *SynTestPluginGRPCClient) Finish() error
func (*SynTestPluginGRPCClient) Initialise ¶
func (t *SynTestPluginGRPCClient) Initialise(config proto.SynTestConfig) error
func (*SynTestPluginGRPCClient) PerformTest ¶
func (t *SynTestPluginGRPCClient) PerformTest(trigger proto.Trigger) (proto.TestResult, error)
type SynTestPluginGRPCServer ¶
type SynTestPluginGRPCServer struct {
Impl SynTestPlugin
}
func (*SynTestPluginGRPCServer) Initialise ¶
func (s *SynTestPluginGRPCServer) Initialise(ctx context.Context, config *proto.SynTestConfig) (*proto.Empty, error)
func (*SynTestPluginGRPCServer) PerformTest ¶
func (s *SynTestPluginGRPCServer) PerformTest(ctx context.Context, trigger *proto.Trigger) (*proto.TestResult, error)
type TestDetailsLogger ¶
type TestDetailsLogger struct { Res proto.TestResult // contains filtered or unexported fields }
Simple helper struct to output logs in the test result details
func (*TestDetailsLogger) Log ¶
func (l *TestDetailsLogger) Log(msg string)
type TestRunStatus ¶
type TestRunStatus int
Status of a test run
const ( Failing TestRunStatus = 1 Warning TestRunStatus = 2 Passing TestRunStatus = 3 Unknown TestRunStatus = 0 )
func GetTestRunStatus ¶
func GetTestRunStatus(testRun proto.TestRun) TestRunStatus
Computes test run status from the test run results