querytracker

package
v0.0.0-...-a2dbdad Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: AGPL-3.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

View Source
const FLUSH_SLEEP_SECS = 120
View Source
const MAX_CANDIDATE_QUERIES = 10_000 // this limits how many unique queries we use in our stats calculations
View Source
const MAX_NUM_GROUPBY_COLS = 10
View Source
const MAX_QUERIES_TO_TRACK = 100 // this limits how many PQS searches we are doing
View Source
const STALE_QUERIES_EXPIRY_SECS = 21600 // queries will get booted out if they have not been seen in 6 hours
View Source
const STALE_SLEEP_SECS = 1800

Variables

This section is empty.

Functions

func ClearPqs

func ClearPqs()

func GetHashForAggs

func GetHashForAggs(a *structs.QueryAggregators) string

func GetHashForQuery

func GetHashForQuery(n *structs.SearchNode) string
  ALGORITHM for creating a unique hash

   1. In each struct maintain a hid (hashid), it is pre-determined way of creating hash out of
	  of elements of that struct in the sequence they are defined in the go files
   2. If a struct has sub-structs then we recursively call the hashid func
   3. if the hid is already present then we use it else we calculate it for that data type
   4. we keep doing recursive until we get base data types of go like int, bool, string, etc...
   5. This is a pretty standard way of creating id borrowed from the java world

func GetPQSById

func GetPQSById(ctx *fasthttp.RequestCtx)

writes the json converted search node

func GetPQSSummary

func GetPQSSummary(ctx *fasthttp.RequestCtx)

func GetPersistentColumns

func GetPersistentColumns(intable string, orgid uint64) (map[string]bool, error)

func GetTopNPersistentSearches

func GetTopNPersistentSearches(intable string, orgid uint64) (map[string]*structs.SearchNode, error)

func GetTopPersistentAggs

func GetTopPersistentAggs(table string) ([]string, map[string]bool)

returns a sorted slice of most used group by columns, and all measure columns.

func InitQT

func InitQT()

func IsQueryPersistent

func IsQueryPersistent(tableName []string, sn *structs.SearchNode) (bool, error)

func PostPqsAggCols

func PostPqsAggCols(ctx *fasthttp.RequestCtx)

func PostPqsClear

func PostPqsClear(ctx *fasthttp.RequestCtx)

func RefreshExternalAggsInfo

func RefreshExternalAggsInfo(fNames []string) error

func RefreshExternalPQInfo

func RefreshExternalPQInfo(fNames []string) error

func UpdateQTUsage

func UpdateQTUsage(tableName []string, sn *structs.SearchNode, aggs *structs.QueryAggregators)

Types

type PersistentAggregation

type PersistentAggregation struct {
	QueryAggs *structs.QueryAggregators
	PersistentInfo
}

type PersistentGroupBy

type PersistentGroupBy struct {
	GroupByCols map[string]bool
	MeasureCols map[string]bool
}

type PersistentInfo

type PersistentInfo struct {
	AllTables     map[string]bool
	LocalUsage    uint32
	TotalUsage    uint32 `json:"-"`
	LastUsedEpoch uint64
	Pqid          string
}

type PersistentSearchNode

type PersistentSearchNode struct {
	SearchNode *structs.SearchNode
	PersistentInfo
}

func GetQTUsageInfo

func GetQTUsageInfo(tableName []string, sn *structs.SearchNode) (*PersistentSearchNode, error)

Jump to

Keyboard shortcuts

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