Documentation ¶
Index ¶
- Constants
- type AdapterResponse
- type AdapterResult
- type ContractInfoJSON
- type ExplorerClient
- type ExplorerConfig
- type ExtendedLokiClient
- type HttpInitializer
- type HttpInitializerTemplate
- type HttpRequest
- type HttpResponse
- type HttpResponseTemplate
- type KafkaRestClient
- type KafkaRestConfig
- type LocalLogger
- type LokiClient
- func (m *LokiClient) AllHandleResults() []PromtailSendResult
- func (m *LokiClient) Handle(ls model.LabelSet, t time.Time, s string) error
- func (m *LokiClient) HandleStruct(ls model.LabelSet, t time.Time, st interface{}) error
- func (m *LokiClient) LastHandleResult() PromtailSendResult
- func (m *LokiClient) Stop()
- type LokiConfig
- type MockPromtailClient
- func (c *MockPromtailClient) AllHandleResults() []PromtailSendResult
- func (c *MockPromtailClient) Handle(labels model.LabelSet, time time.Time, entry string) error
- func (c *MockPromtailClient) HandleStruct(ls model.LabelSet, t time.Time, st interface{}) error
- func (c *MockPromtailClient) LastHandleResult() PromtailSendResult
- func (c *MockPromtailClient) Stop()
- type MockserverClient
- func (em *MockserverClient) ClearExpectation(body interface{}) error
- func (em *MockserverClient) PutExpectations(body interface{}) error
- func (em *MockserverClient) SetAnyValuePath(path string, v interface{}) error
- func (em *MockserverClient) SetRandomValuePath(path string) error
- func (em *MockserverClient) SetValuePath(path string, v int) error
- type MockserverConfig
- type Name
- type NodeAccessKeys
- type NodeInfoJSON
- type PathSelector
- type PostgresConfig
- type PostgresConnector
- type Prometheus
- type PromtailSendResult
- type ResourcesSummary
Constants ¶
const ( QueryMemoryUsage = `` /* 201-byte string literal not displayed */ QueryAllCPUBusyPercentage = `100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[%s])) * 100)` )
Query constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdapterResponse ¶
type AdapterResponse struct { Id string `json:"id"` Data AdapterResult `json:"data"` Error interface{} `json:"error"` }
AdapterResponse represents a response from an adapter
type AdapterResult ¶
type AdapterResult struct {
Result int `json:"result"`
}
AdapterResult represents an int result for an adapter
type ContractInfoJSON ¶
type ContractInfoJSON struct { ContractAddress string `json:"contractAddress"` ContractVersion int `json:"contractVersion"` Path string `json:"path"` Status string `json:"status"` }
ContractInfoJSON represents an element of the contracts array used to deliver configs to otpe
type ExplorerClient ¶
type ExplorerClient struct { APIClient *resty.Client Config *ExplorerConfig }
ExplorerClient is used to call Explorer API endpoints
func NewExplorerClient ¶
func NewExplorerClient(cfg *ExplorerConfig) *ExplorerClient
NewExplorerClient creates a new explorer mock client
func (*ExplorerClient) PostAdminNodes ¶
func (em *ExplorerClient) PostAdminNodes(nodeName string) (NodeAccessKeys, error)
PostAdminNodes is used to exercise the POST /api/v1/admin/nodes endpoint This endpoint is used to create access keys for nodes
type ExplorerConfig ¶
ExplorerConfig holds config information for ExplorerClient
type ExtendedLokiClient ¶ added in v1.10.3
type ExtendedLokiClient interface { lokiClient.Client api.EntryHandler HandleStruct(ls model.LabelSet, t time.Time, st interface{}) error LastHandleResult() PromtailSendResult AllHandleResults() []PromtailSendResult }
ExtendedLokiClient an extended Loki/Promtail client used for testing last results in batch
func NewMockPromtailClient ¶ added in v1.10.3
func NewMockPromtailClient() ExtendedLokiClient
type HttpInitializer ¶
type HttpInitializer struct { Id string `json:"id"` Request HttpRequest `json:"httpRequest"` Response HttpResponse `json:"httpResponse"` }
HttpInitializer represents an element of the initializer array used in the mockserver initializer
type HttpInitializerTemplate ¶ added in v1.9.10
type HttpInitializerTemplate struct { Id string `json:"id"` Request HttpRequest `json:"httpRequest"` Response HttpResponseTemplate `json:"httpResponseTemplate"` }
HttpInitializer represents an element of the initializer array used in the mockserver initializer
type HttpRequest ¶
type HttpRequest struct {
Path string `json:"path"`
}
HttpRequest represents the httpRequest json object used in the mockserver initializer
type HttpResponse ¶
type HttpResponse struct {
Body interface{} `json:"body"`
}
HttpResponse represents the httpResponse json object used in the mockserver initializer
type HttpResponseTemplate ¶ added in v1.9.10
type HttpResponseTemplate struct { Template string `json:"template"` TemplateType string `json:"templateType"` }
HttpResponse represents the httpResponse json object used in the mockserver initializer
type KafkaRestClient ¶
type KafkaRestClient struct { APIClient *resty.Client Config *KafkaRestConfig }
KafkaRestClient kafka-rest client
func NewKafkaRestClient ¶
func NewKafkaRestClient(cfg *KafkaRestConfig) *KafkaRestClient
NewKafkaRestClient creates a new KafkaRestClient
func (*KafkaRestClient) GetTopics ¶
func (krc *KafkaRestClient) GetTopics() ([]string, error)
GetTopics Get a list of Kafka topics.
type KafkaRestConfig ¶
type KafkaRestConfig struct {
URL string
}
KafkaRestConfig holds config information for KafkaRestClient
type LocalLogger ¶ added in v1.10.3
type LocalLogger struct{}
func (*LocalLogger) Log ¶ added in v1.10.3
func (m *LocalLogger) Log(kvars ...interface{}) error
type LokiClient ¶ added in v1.10.3
type LokiClient struct {
lokiClient.Client
}
LokiClient is a Loki/Promtail client wrapper
func NewLokiClient ¶ added in v1.10.3
func NewLokiClient(extCfg *LokiConfig) (*LokiClient, error)
NewLokiClient creates a new Loki/Promtail client
func (*LokiClient) AllHandleResults ¶ added in v1.10.3
func (m *LokiClient) AllHandleResults() []PromtailSendResult
func (*LokiClient) Handle ¶ added in v1.10.3
Handle handles adding a new label set and a message to the batch
func (*LokiClient) HandleStruct ¶ added in v1.10.3
HandleStruct handles adding a new label set and a message to the batch, marshalling JSON from struct
func (*LokiClient) LastHandleResult ¶ added in v1.10.3
func (m *LokiClient) LastHandleResult() PromtailSendResult
func (*LokiClient) Stop ¶ added in v1.10.3
func (m *LokiClient) Stop()
Stop stops the client goroutine
type LokiConfig ¶ added in v1.10.3
type LokiConfig struct { // URL url to Loki endpoint URL string `yaml:"url"` // Token is Loki authorization token Token string `yaml:"token"` // BatchWait max time to wait until sending a new batch BatchWait time.Duration `yaml:"batch_wait"` // BatchSize size of a messages batch BatchSize int `yaml:"batch_size"` // Timeout is a batch send timeout Timeout time.Duration `yaml:"timeout"` }
LokiConfig Loki/Promtail client configuration
func NewDefaultLokiConfig ¶ added in v1.10.3
func NewDefaultLokiConfig(url string, token string) *LokiConfig
type MockPromtailClient ¶ added in v1.10.3
type MockPromtailClient struct { Results []PromtailSendResult OnHandleEntry api.EntryHandlerFunc }
func (*MockPromtailClient) AllHandleResults ¶ added in v1.10.3
func (c *MockPromtailClient) AllHandleResults() []PromtailSendResult
func (*MockPromtailClient) HandleStruct ¶ added in v1.10.3
func (*MockPromtailClient) LastHandleResult ¶ added in v1.10.3
func (c *MockPromtailClient) LastHandleResult() PromtailSendResult
func (*MockPromtailClient) Stop ¶ added in v1.10.3
func (c *MockPromtailClient) Stop()
Stop implements client.Client
type MockserverClient ¶
type MockserverClient struct { APIClient *resty.Client Config *MockserverConfig }
MockserverClient mockserver client
func ConnectMockServer ¶
func ConnectMockServer(e *environment.Environment) (*MockserverClient, error)
ConnectMockServer creates a connection to a deployed mockserver in the environment
func NewMockserverClient ¶
func NewMockserverClient(cfg *MockserverConfig) *MockserverClient
NewMockserverClient returns a mockserver client
func (*MockserverClient) ClearExpectation ¶
func (em *MockserverClient) ClearExpectation(body interface{}) error
ClearExpectation clears expectations
func (*MockserverClient) PutExpectations ¶
func (em *MockserverClient) PutExpectations(body interface{}) error
PutExpectations sets the expectations (i.e. mocked responses)
func (*MockserverClient) SetAnyValuePath ¶ added in v1.6.0
func (em *MockserverClient) SetAnyValuePath(path string, v interface{}) error
SetAnyValuePath sets any type of value for a path
func (*MockserverClient) SetRandomValuePath ¶ added in v1.9.10
func (em *MockserverClient) SetRandomValuePath(path string) error
SetRandomValuePath sets a random int value for a path
func (*MockserverClient) SetValuePath ¶
func (em *MockserverClient) SetValuePath(path string, v int) error
SetValuePath sets an int for a path
type MockserverConfig ¶
MockserverConfig holds config information for MockserverClient
type NodeAccessKeys ¶
type NodeAccessKeys struct { ID string `json:"id"` AccessKey string `json:"accessKey"` Secret string `json:"secret"` }
NodeAccessKeys is the body of the response
type NodeInfoJSON ¶
NodeInfoJSON represents an element of the nodes array used to deliver configs to otpe
type PathSelector ¶
type PathSelector struct {
Path string `json:"path"`
}
PathSelector represents the json object used to find expectations by path
type PostgresConfig ¶
PostgresConfig postgres config for connection string
type PostgresConnector ¶
type PostgresConnector struct { *sqlx.DB Cfg *PostgresConfig }
PostgresConnector sqlx postgres connector
func ConnectDB ¶ added in v1.6.3
func ConnectDB(nodeNum int, e *environment.Environment) (*PostgresConnector, error)
func NewPostgresConnector ¶
func NewPostgresConnector(cfg *PostgresConfig) (*PostgresConnector, error)
NewPostgresConnector creates new sqlx postgres connector
type Prometheus ¶
Prometheus ease of use for v1.API
func NewPrometheusClient ¶
func NewPrometheusClient(url string) (*Prometheus, error)
NewPrometheusClient returns a prometheus client
func (*Prometheus) CPUBusyPercentage ¶
func (p *Prometheus) CPUBusyPercentage() (float64, error)
CPUBusyPercentage host CPU busy percentage
func (*Prometheus) GetAlerts ¶
func (p *Prometheus) GetAlerts() (v1.AlertsResult, error)
GetAlerts returns all firing alerts
func (*Prometheus) GetQuery ¶
func (p *Prometheus) GetQuery(query string) (model.Value, error)
GetQuery returns the result of applying a PromQL query
func (*Prometheus) MemoryUsage ¶
func (p *Prometheus) MemoryUsage() (float64, error)
MemoryUsage total memory used by interval
func (*Prometheus) ResourcesSummary ¶
func (p *Prometheus) ResourcesSummary() (float64, float64, error)
ResourcesSummary returns a summary of memory and cpu used
type PromtailSendResult ¶ added in v1.10.3
type ResourcesSummary ¶
ResourcesSummary Data for memory and cpu usage