Documentation ¶
Index ¶
- Variables
- func AddToMetricCounter(key string, value float64, info string, labels map[string]string)
- func AdminClearCommandHistory()
- func AreAllConditionLockTimersAvailable(action data.Condition, botGroup *data.BotGroup) bool
- func AreAllConditionStatesActive(action data.Condition, bot *data.Bot) bool
- func AverageAndFixup(runningScore float64, considerCount int) (float64, []string)
- func CalculateScore(action data.Condition, actionData data.BotConditionData) (float64, []string)
- func CleanMetricKeyString(key string) string
- func FormatBotVariable(format data.BotVariableFormat, value float64) string
- func GetAPIPlotData(c *fiber.Ctx) string
- func GetAPIPlotMetrics(c *fiber.Ctx) string
- func GetBot(botGroup *data.BotGroup, botName string) (data.Bot, error)
- func GetBotCurrentStateAndIndex(botGroup *data.BotGroup, bot *data.Bot, stateBase string) (string, int, error)
- func GetBotForwardSequenceState(botGroup *data.BotGroup, name string) (data.BotForwardSequenceState, error)
- func GetBotGroup(interactiveControl data.InteractiveControl, site *data.Site, ...) (data.BotGroup, error)
- func GetBotGroupAllBotVariablesByName(botGroup data.BotGroup, varName string) []map[string]string
- func GetBotVariableData(botGroup *data.BotGroup, varName string) (data.BotVariable, error)
- func GetBotsInState(botGroup *data.BotGroup, stateName string, stateLabel string) []data.Bot
- func GetCommandHistoryAll(session *data.InteractiveSession, count int) []data.ConditionCommandResult
- func GetCondition(botGroup *data.BotGroup, actionName string) (data.Condition, error)
- func GetConditionConsideration(action data.Condition, considerName string) (data.ConditionConsideration, error)
- func GetConditionLastExecuteTime(session *data.InteractiveSession, botGroup *data.BotGroup, bot *data.Bot, ...) (time.Time, error)
- func GetCurveDataX(curveData CurveData) []float64
- func GetCurveValue(curveData CurveData, x float64) float64
- func GetInteractiveSession(interactiveControl data.InteractiveControl, site *data.Site) data.InteractiveSession
- func GetLockTimer(botGroup *data.BotGroup, lockTimerName string) (*data.BotLockTimer, error)
- func GetMetricCounter(key string, labels map[string]string) (*data.PrometheusMetricCounter, error)
- func GetMetricGauge(key string, labels map[string]string) (*data.PrometheusMetricGauge, error)
- func GetMetricLabelsAndInfo_Bot(botGroup *data.BotGroup, bot *data.Bot) map[string]string
- func GetMetricLabelsAndInfo_BotVariable(botGroup *data.BotGroup, bot *data.Bot, varName string) map[string]string
- func GetMetricLabelsAndInfo_Condition(botGroup *data.BotGroup, bot *data.Bot, condition data.Condition) map[string]string
- func GetProductionInteractiveControl() data.InteractiveControl
- func GetQuery(botGroup *data.BotGroup, queryName string) (data.BotQuery, error)
- func GetQueryResultByQueryKey(site *data.Site, queryKey string) (data.QueryResultPoolItem, bool)
- func GetQueryServer(site *data.Site, name string) (data.QueryServer, error)
- func GetRawMetricsJSON(c *fiber.Ctx) string
- func GetStateIndex(botGroup *data.BotGroup, state string) (int, error)
- func GetVariable(botGroup *data.BotGroup, varName string) (data.BotVariable, error)
- func IsEqualMapStringString(m1 map[string]string, m2 map[string]string) bool
- func LoadBotGroupConfig(path string) data.BotGroup
- func LoadConfig(path string) data.AppConfig
- func LoadSiteConfig(appConfig data.AppConfig) data.Site
- func ResetBotState(botGroup *data.BotGroup, bot *data.Bot, stateBase string) error
- func SetAllConditionLockTimers(action data.Condition, botGroup *data.BotGroup, duration data.Duration)
- func SetBotStates(botGroup *data.BotGroup, bot *data.Bot, setStates []string) error
- func SetLockTimer(botGroup *data.BotGroup, lockTimerName string, duration data.Duration)
- func SetMetricGauge(key string, value float64, info string, labels map[string]string)
- func SortMapStringConditionDataByFinalScore(input map[string]data.BotConditionData, sortForward bool) data.PairBotConditionDataList
- type CurveData
Constants ¶
This section is empty.
Variables ¶
var (
Curves []CurveData
)
Functions ¶
func AddToMetricCounter ¶
Set a Metric Counter, and create it if it doesn/t already exist
func AdminClearCommandHistory ¶
func AdminClearCommandHistory()
ADMIN: Clear the Command History to make the demo look nicer. Only available if Demo is enabled
func AreAllConditionLockTimersAvailable ¶
For a given Condition, does this Bot Group have all the Lock Timers available to be locked?
func AreAllConditionStatesActive ¶
For a given Condition, does this Bot have all the RequiredStates active?
func AverageAndFixup ¶
This is the heuristic we use to get a good "modified average" of the Considerations to a Consideration Final Score This works well when all the ConditionConsideration.Weight values are ~1.0, so that they have relative importance to each other. Try to keep ConditionConsideration.Weight values between 0.1 and 10.0 for a good result.
func CalculateScore ¶
Calculate the Utility Score for a given Condition using a Bots BotConditionData
func CleanMetricKeyString ¶
For dynamic metric keys, this will clean them for Prometheus
func FormatBotVariable ¶
func FormatBotVariable(format data.BotVariableFormat, value float64) string
Bot.VariableValues are all floats, but we want them to have human readable strings
func GetAPIPlotData ¶
func GetAPIPlotData(c *fiber.Ctx) string
Returns JSON data needed to create a Plotly graph for our Curves
func GetAPIPlotMetrics ¶
func GetAPIPlotMetrics(c *fiber.Ctx) string
func GetBotCurrentStateAndIndex ¶
func GetBotCurrentStateAndIndex(botGroup *data.BotGroup, bot *data.Bot, stateBase string) (string, int, error)
Returns the index of the State currently for this Bot, with the stateBase (BotForwardSequenceState.Name)
func GetBotGroup ¶
func GetBotGroup(interactiveControl data.InteractiveControl, site *data.Site, botGroupName string) (data.BotGroup, error)
Gets a BotGroup from the Site, using the InteractiveControl
func GetBotGroupAllBotVariablesByName ¶
Returns an array of maps, formatted with the BotVariable name and value
func GetBotVariableData ¶
Returns a BotGroup variable, by name
func GetBotsInState ¶
Returns a slice of Bots in this BotGroup that have this state
func GetCommandHistoryAll ¶
func GetCommandHistoryAll(session *data.InteractiveSession, count int) []data.ConditionCommandResult
Returns all the ConditionCommandResults for all Bots in the BotGroups in this Session, sorted by time, descending
func GetCondition ¶
Get a Condition from a BotGroup, by name
func GetConditionConsideration ¶
func GetConditionConsideration(action data.Condition, considerName string) (data.ConditionConsideration, error)
Get a ConditionConsideration from a Condition, by name
func GetCurveDataX ¶
Get all X axis values, which is just the step from 0-1 at 0.1 intervals
func GetCurveValue ¶
Get the Y value, at an X position, in the curve
func GetInteractiveSession ¶
func GetInteractiveSession(interactiveControl data.InteractiveControl, site *data.Site) data.InteractiveSession
Takes an InteractiveControl struct, and creates a InteractiveSession, which is used everywhere and contains live BotGroups
func GetLockTimer ¶
Get a BotLockTimer from the BotGroup
func GetMetricCounter ¶
Get an existing Metric Counter
func GetMetricGauge ¶
Get an existing Metric Counter
func GetMetricLabelsAndInfo_Bot ¶
Returns the map used for Labels in a Metric, for a Bot
func GetMetricLabelsAndInfo_BotVariable ¶
func GetMetricLabelsAndInfo_BotVariable(botGroup *data.BotGroup, bot *data.Bot, varName string) map[string]string
Returns the map used for Labels in a Metric, for a Bot's Variable
func GetMetricLabelsAndInfo_Condition ¶
func GetMetricLabelsAndInfo_Condition(botGroup *data.BotGroup, bot *data.Bot, condition data.Condition) map[string]string
Returns the map used for Labels in a Metric, for a Condition
func GetProductionInteractiveControl ¶
func GetProductionInteractiveControl() data.InteractiveControl
GetProductionInteractiveControl returns a SessionUUID==0 data set for production data. TODO(ghowland): These should be altered by AppConfig
func GetQueryServer ¶
Returns a QueryServer, scope is per Site
func GetRawMetricsJSON ¶
func GetRawMetricsJSON(c *fiber.Ctx) string
func GetStateIndex ¶
Returns the index of the State inside it's BotForwardSequenceState. Important because States can only increase or reset to 0 index.
func GetVariable ¶
Get a Variable defintion from BotGroup, by name. Not the Variable Value, which is stored in Bot.
func IsEqualMapStringString ¶
func LoadBotGroupConfig ¶
Load the BotGroup config from a path
func LoadSiteConfig ¶
Load our Site config for a path
func ResetBotState ¶
func SetAllConditionLockTimers ¶
func SetAllConditionLockTimers(action data.Condition, botGroup *data.BotGroup, duration data.Duration)
When executing a Condition, we will set all the Lock Timers that Condition required, for the duration specified in the ConditionCommand
func SetBotStates ¶
When executing a Condition, we want to update the Bots States, to move it forward
func SetLockTimer ¶
func SetMetricGauge ¶
Set a Metric Gauge, and create it if it doesn/t already exist
func SortMapStringConditionDataByFinalScore ¶
func SortMapStringConditionDataByFinalScore(input map[string]data.BotConditionData, sortForward bool) data.PairBotConditionDataList
Go doesnt handle map sorting easily, so this is the fix-up
Types ¶
type CurveData ¶
Points to create a curve. Standard is 0-1 at 0.1 steps, so 1000 points
func LoadCurveData ¶
Load the Curve data off the disk