extdata

package
v0.0.0-...-96ebf97 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFormattedVariables

func CreateFormattedVariables(session *data.InteractiveSession, botGroupIndex int)

Create formatted variables for all our Bots. This adds human-readable strings to all the sorted Pair Lists

func ExecuteBotCondition

func ExecuteBotCondition(session *data.InteractiveSession, botGroup *data.BotGroup, bot *data.Bot, condition data.Condition, conditionData data.BotConditionData)

func ExecuteBotGroupConditions

func ExecuteBotGroupConditions(session *data.InteractiveSession, botGroupIndex int) bool

Execute the highest scoring condition for any Bot in this Bot Group, if it is Available and meets all conditions

func ExportMetricsOnVariables

func ExportMetricsOnVariables(session *data.InteractiveSession, botGroupIndex int)

func ExtractBotsFromPromData

func ExtractBotsFromPromData(response data.PrometheusResponse, botGroup *data.BotGroup) []data.Bot

Extract our ephemeral Bots from the Prometheus response, using the BotKey extractor information

func GetBotEvalMapAllVariables

func GetBotEvalMapAllVariables(bot *data.Bot) map[string]interface{}

Returns the map for doing the Evaluate with a Bots VariableValues. Uses Govaluate.Evaluate() NOTE(ghowland): bot.AccessLock should already be locked before we come here, because we are accessing a map

func GetBotEvalMapOnlyQueries

func GetBotEvalMapOnlyQueries(bot data.Bot, queryVariableNames []string) map[string]interface{}

Returns the map for doing the Evaluate against a Query to create our Scores. Uses Govaluate.Evaluate() NOTE(ghowland): bot.AccessLock should already be locked before we come here, because we are accessing a map

func GetCachedQueryResult

func GetCachedQueryResult(session *data.InteractiveSession, site *data.Site, query data.BotQuery) (data.QueryResult, error)

GetCachedQueryResult returns a cached query result. Web App requests should set errorOverInterval=false, which is used by the background query system to test missing or expired query results as equivalent.

func GetQueryKey

func GetQueryKey(session *data.InteractiveSession, query data.BotQuery) string

GetQueryKey returns "(QueryServer).(Query)", so it can be shared by any BotGroup

func InitializeBotStates

func InitializeBotStates(botGroup *data.BotGroup, bot *data.Bot)

Initialize all the States for this BotGroups Bots. They should all start at the first state value, and only move forward or reset.

func IsQueryLocked

func IsQueryLocked(session *data.InteractiveSession, site *data.Site, query data.BotQuery) bool

IsQueryLocked returned whether this Query currently being requested. Don't want to request more than once at a time

func QueryCacheSet

func QueryCacheSet(session *data.InteractiveSession, site *data.Site, query data.BotQuery, newCacheItem data.QueryResultPoolItem)

func QueryLockClear

func QueryLockClear(site *data.Site, queryKey string)

QueryLockClear will clear the Query Lock, so we can make this Query again after the Interval

func QueryLockSet

func QueryLockSet(site *data.Site, queryKey string)

QueryLockSet will set the Query Lock for a QueryKey, so we won't request this Query again until it finishes or the AppConfig.QueryLockTimeout expires

func QueryPrometheus

func QueryPrometheus(host string, port int, queryType data.BotQueryType, query string, timeStart time.Time, duration time.Duration) data.PrometheusResponse

Query the Prometheus metric server

func SortAllVariablesAndConditions

func SortAllVariablesAndConditions(session *data.InteractiveSession, botGroupIndex int)

Sort all the Variables by name and Conditions by Final Score

func StoreQueryResult

func StoreQueryResult(session *data.InteractiveSession, site *data.Site, query data.BotQuery, startTime time.Time, queryResult data.QueryResult)

StoreQueryResult will store a QueryResult in the cache

func UpdateBotConditionConsiderations

func UpdateBotConditionConsiderations(session *data.InteractiveSession, botGroupIndex int)

For this BotGroup, update all the BotConditionData with new ConditionConsideration scores

func UpdateBotGroupFromPrometheus

func UpdateBotGroupFromPrometheus(session *data.InteractiveSession, site *data.Site, botGroupIndex int)

Runs Queries against Prometheus for a BotGroup

func UpdateBotsFromQueries

func UpdateBotsFromQueries(session *data.InteractiveSession, site *data.Site, botGroupIndex int)

Update all the Bot VariableValues from our Queries

func UpdateBotsWithSyntheticVariables

func UpdateBotsWithSyntheticVariables(session *data.InteractiveSession, botGroupIndex int)

Update bot with Synthetic Variables. Happens after all the Query Variables are set. Synthetic vars can't work on each other

func UpdateSiteBotGroups

func UpdateSiteBotGroups(session *data.InteractiveSession)

Update all the BotGroups in this Site

Types

This section is empty.

Jump to

Keyboard shortcuts

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