Documentation ¶
Index ¶
- Constants
- func TriggerScaling(w http.ResponseWriter, r *http.Request)
- type AddDatabaseRequest
- type AddDatabaseRequestDatabaseInformation
- type AddDatabaseResponse
- type DataStoreCondition
- type DataStoreDocumentation
- type DataStoreIncident
- type DatabaseHost
- type IncidentRequest
- type InicidentMetaData
- type InstanceData
- type InstanceMetaData
- type ModifyDatabaseRequest
- type ModifyUserRequest
- type ProxySqlConfig
- type ProxySqlConfigAdminVariables
- type ProxySqlConfigMysqlVariables
- type ProxySqlMySqlQueryRule
- type ProxySqlMySqlServer
- type ProxySqlMySqlUser
- type RemoveDatabaseRequest
Constants ¶
const ConfigUpdate string = "config_update"
ConfigUpdate means the daemon created the instance, and updated the configmap for the related proxysql instance
const DaemonAck string = "daemon_ack"
DaemonAck means the daemon acknowledged the incident
const GCFPush string = "gcf_push"
consts used for incident data steps GCFPush means the last updated step was it was received from stackdriver to GCF
const InstanceInsert string = "instance_insert"
InstanceInsert means the daemon attempted to modify the instance via the sqladmin API. See DataStoreIncident.OperationID for what operation to query.
const ProxysqlRestart string = "proxysql_restart"
ProxySQL restart means the proxysql deployment was restarted
const StatusCheck string = "status_check"
StatusCheck means it was in the process of waiting to recheck the status of this incident from datastore.
Variables ¶
This section is empty.
Functions ¶
func TriggerScaling ¶
func TriggerScaling(w http.ResponseWriter, r *http.Request)
Types ¶
type AddDatabaseRequest ¶
type AddDatabaseRequest struct { Action string `json:"action"` InstanceName string `json:"instance_name"` Username string `json:"username"` Password string `json:"password"` MasterInstance AddDatabaseRequestDatabaseInformation `json:"master_instance"` ReadReplicas []AddDatabaseRequestDatabaseInformation `json:"read_replicas"` QueryRules []ProxySqlMySqlQueryRule `json:"query_rules,omitempty"` // these next three will be used once proxysql updates to have instance:ssl config KeyData string `json:"key_data"` CertData string `json:"cert_data"` CAData string `json:"ca_data"` // binary bool, 0 = false, 1 true EnableSSL int `json:"enable_ssl"` }
type AddDatabaseResponse ¶
type AddDatabaseResponse struct { Action string `json:"action"` QueryRules []ProxySqlMySqlQueryRule `json:"query_rules"` InstanceName string `json:"instance_name"` Username string `json:"username"` Password string `json:"password"` WriteHostGroup int `json:"write_host_group"` ReadHostGroup int `json:"read_host_group"` SSLEnabled int `json:"ssl_enabled"` }
type DataStoreCondition ¶
type DataStoreCondition struct { IncidentID string `json:"incident_id"` PolicyName string `json:"policy_name"` }
DataStoreCondition contains policy data about the incident
type DataStoreDocumentation ¶
type DataStoreDocumentation struct { Content string `json:"content"` MimeType string `json:"mime_type"` }
DataStoreDocumentation is metadata about the alert stored in the documentation attribute
type DataStoreIncident ¶
type DataStoreIncident struct { IncidentID string `json:"incident_id"` PolicyName string `json:"policy_name"` State string `json:"state"` StartedAt int64 `json:"started_at"` ClosedTimestamp string `json:"closed_timestamp"` Condition DataStoreCondition `json:"condition"` SqlMasterInstance string `json:"sql_master_instance"` ReplicaBaseName string `json:"replica_basename"` Documentation DataStoreDocumentation `json:"documentation"` InProgress bool `json:"in_progress,omitempty"` Action string `json:"action"` // Last process will give us the last thing the daemon attempted to do before it was killed. LastProcess string `json:"last_process"` // Operation ID is the way we can query an operation that was done against the sql admin API OperationID string `json:"operation_id"` // Last updated shows us when the incident was last updated, I'll add the RFC to this comment later LastUpdated string `json:"last_updated"` // Last updated by shows us what actor last updated this request. LastUpdatedBy string `json:"last_updated_by"` }
DataStoreIncident is the incident structure inside of datastore
type DatabaseHost ¶
type IncidentRequest ¶
type IncidentRequest struct {
Incident DataStoreIncident `json:"incident"`
}
IncidentRequest stores high level data about an incident triggered from GCP monitoring
type InicidentMetaData ¶
type InicidentMetaData struct { ReplicaBaseName string `json:"replica_basename"` SqlMasterInstance string `json:"sql_master_instance"` Action string `json:"action"` InstanceGroup string `json:"instance_group"` }
InicidentMetaData contains metadata about instances in the incident
type InstanceData ¶
type InstanceData struct { InstanceName string `json:"instance_name"` ReadHostGroup int `json:"read_hostgroup"` WriteHostGroup int `json:"write_hostgroup"` Username string `json:"username"` Password string `json:"password"` QueryRules []ProxySqlMySqlQueryRule `json:"query_rules"` MasterInstance AddDatabaseRequestDatabaseInformation `json:"master_instance"` ReadReplicas []AddDatabaseRequestDatabaseInformation `json:"read_replicas"` UseSSL int `json:"use_ssl"` }
type InstanceMetaData ¶
type InstanceMetaData struct {
InstanceMetaData string `json:"instance_metadata" datastore:"instance_metadata"`
}
type ModifyDatabaseRequest ¶
type ModifyDatabaseRequest struct { Action string `json:"action"` InstanceName string `json:"instance_name"` Username string `json:"username"` AddQueryRules []ProxySqlMySqlQueryRule `json:"add_query_rules"` RemoveQueryRules []int `json:"remove_query_rules"` }
type ModifyUserRequest ¶
type ModifyUserRequest struct { Action string `json:"action"` Username string `json:"username"` NewUsername string `json:"new_username,omitempty"` Password string `json:"password,omitempty"` InstanceGroup string `json:"instance_group,omitempty"` DefaultHostgroup int `json:"default_host_group,omitempty"` }
type ProxySqlConfig ¶
type ProxySqlConfig struct { DataDir string `libconfig:"datadir" json:"datadir"` AdminVariables ProxySqlConfigAdminVariables `libconfig:"admin_variables" json:"admin_variables"` MysqlVariables ProxySqlConfigMysqlVariables `libconfig:"mysql_variables" json:"mysql_variables"` MySqlServers []ProxySqlMySqlServer `libconfig:"mysql_servers" json:"mysql_servers"` MySqlUsers []ProxySqlMySqlUser `libconfig:"mysql_users" json:"mysql_users"` MySqlQueryRules []ProxySqlMySqlQueryRule `libconfig:"mysql_query_rules" json:"mysql_query_rules"` ReadHostGroup int `json:"read_hostgroup"` WriteHostGroup int `json:"write_hostgroup"` // int here is either 0 = false or 1 = true. UseSSL int `json:"use_ssl"` // These are the top level certs that I will not be using, here for prosterity KeyData string `json:"key,omitempty"` CertData string `json:"cert,omitempty"` CAData string `json:"ca_data,omitempty"` }
ProxySqlConfig is the datastore/libconfig struct that configures a proxysql instance
func NewProxySqlConfig ¶
func NewProxySqlConfig() *ProxySqlConfig
func (*ProxySqlConfig) AddReadReplica ¶
func (psql *ProxySqlConfig) AddReadReplica(readReplica ProxySqlMySqlServer)
func (*ProxySqlConfig) InitDefaults ¶
func (psql *ProxySqlConfig) InitDefaults()
TODO: Get this from a file
func (*ProxySqlConfig) MarshallJSON ¶
func (psql *ProxySqlConfig) MarshallJSON() []byte
func (*ProxySqlConfig) ToLibConfig ¶
func (psql *ProxySqlConfig) ToLibConfig() ([]byte, error)
TODO: GCP uses 1:1 for ssl and replica, SSL won't work
with proxysql. I have an issue open with them to fix this, or I'll do it myself https://github.com/sysown/proxysql/issues/3331
type ProxySqlConfigMysqlVariables ¶
type ProxySqlConfigMysqlVariables struct { Threads int `libconfig:"threads" json:"threads"` MaxConnections int64 `libconfig:"max_connections" json:"max_connections"` DefaultQueryDelay int `libconfig:"default_query_delay" json:"default_query_delay"` DefaultQueryTimeout int64 `libconfig:"default_query_timeout" json:"default_query_timeout"` HaveCompress bool `libconfig:"have_compress" json:"have_compress"` PollTimeout int64 `libconfig:"poll_timeout" json:"poll_timeout"` Interfaces string `libconfig:"interfaces" json:"interfaces"` DefaultSchema string `libconfig:"default_schema" json:"default_schema"` StackSize int64 `libconfig:"stack_size" json:"stack_size"` ServerVersion string `libconfig:"server_version" json:"server_version"` ConnectTimeoutServer int64 `libconfig:"connect_timeout_server" json:"connection_timeout_server"` MonitorHistory int64 `libconfig:"monitor_history" json:"monitor_history"` MonitorConnectInterval int64 `libconfig:"monitor_connect_interval" json:"monitor_connect_interval"` MonitorPingInterval int64 `libconfig:"monitor_ping_interval" json:"monitor_ping_interval"` PingInternalServerMsec int64 `libconfig:"ping_internal_server_msec" json:"ping_internal_server_msec"` PingTimeoutServer int `libconfig:"ping_timeout_server" json:"ping_timeout_server"` CommandsStats bool `libconfig:"command_stats" json:"command_stats"` SessionsSort bool `libconfig:"sessions_sort" json:"sessions_sort"` MonitorUsername string `libconfig:"monitor_username" json:"monitor_username"` MonitorPassword string `libconfig:"monitor_password" json:"monitor_password"` SSLP2SCert string `libconfig:"ssl_p2s_cert" json:"ssl_p2s_cert"` SSLP2SKey string `libconfig:"ssl_p2s_key" json:"ssl_p2s_key"` SSLP2SCA string `libconfig:"ssl_p2s_ca" json:"ssl_p2s_ca"` }
ProxySqlConfigMysqlVariables are the variables that get loaded into global_variables that are prefixed with mysql-
type ProxySqlMySqlQueryRule ¶
type ProxySqlMySqlQueryRule struct { RuleID int `libconfig:"rule_id" json:"rule_id"` Username string `libconfig:"username" json:"username"` // 0 or 1 Active int `libconfig:"active" json:"active"` MatchDigest string `libconfig:"match_digest" json:"match_digest"` DestinationHostgroup int `libconfig:"destination_hostgroup" json:"destination_hostgroup"` // 0 or 1 Apply int `libconfig:"apply" json:"apply"` Comment string `libconfig:"comment" json:"comment"` }
type ProxySqlMySqlServer ¶
type ProxySqlMySqlServer struct { Address string `libconfig:"address" json:"address"` Port int64 `libconfig:"port" json:"port"` Hostgroup int `libconfig:"hostgroup" json:"hostgroup"` MaxConnections int64 `libconfig:"max_connections" json:"max_connections"` Comment string `libconfig:"comment" json:"comment"` UseSSL int `libconfig:"use_ssl" json:"use_ssl"` // These are more here for future features I'm asking for or updating myself // They're omit empty because they're not really supported anywhere, moreso scaffolding KeyData string `json:"key_data,omitempty"` CAData string `json:"ca_data,omitempty"` CertData string `json:"cert_data,omitempty"` }
ProxySqlMySqlServer contains data about the sql server
type ProxySqlMySqlUser ¶
type ProxySqlMySqlUser struct { Username string `libconfig:"username" json:"username"` Password string `libconfig:"password" json:"password"` DefaultHostgroup int `libconfig:"default_hostgroup" json:"default_hostgroup"` // 0 or 1 Active int `libconfig:"active" json:"active"` InstanceGroup string `json:"instance_group"` }