Documentation ¶
Index ¶
- Variables
- func GetCurTick() int
- func SetupRoutes(router *gin.Engine)
- func SqlRunStmt(stmt string, data ...interface{}) (rv []map[string]interface{}, err error)
- func StatMiddleware() gin.HandlerFunc
- func XData(x ...interface{}) (rv string)
- type MetricsData
- func (md *MetricsData) AddCounter(CounterName string, count int) (err error)
- func (md *MetricsData) AddFloatCounter(CounterName string, count float64) (err error)
- func (md *MetricsData) AddMetricsKeys(validKeys []MetricsTypeInfo)
- func (md *MetricsData) Close() error
- func (md *MetricsData) Collect(ch chan<- prometheus.Metric)
- func (md *MetricsData) Describe(ch chan<- *prometheus.Desc)
- func (md *MetricsData) GetCounter(CounterName string) (rv float64)
- func (md *MetricsData) GetData()
- func (md *MetricsData) GetDataJson() (rv string)
- func (md *MetricsData) ResetCounters()
- func (md *MetricsData) SaveData()
- func (md *MetricsData) SetFloatCounter(CounterName string, count float64) (err error)
- type MetricsTypeInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var Stats *stats.Stats
Stats provide response time, status code count, etc.
Functions ¶
func GetCurTick ¶
func GetCurTick() int
GetCurTics returns the number of times that a timeout has saved the data.
func SetupRoutes ¶
func SqlRunStmt ¶
SqlRunStmt will run a single statemt and return the data as an array of maps
func StatMiddleware ¶
func StatMiddleware() gin.HandlerFunc
StatMiddleware response time, status code count, etc.
Types ¶
type MetricsData ¶
type MetricsData struct { Data map[string]float64 Safe sync.Mutex SaveRateSeconds int SaveKey string // contains filtered or unexported fields }
func NewMetricsData ¶
func NewMetricsData(saveKey string, validKeys []MetricsTypeInfo, saveRateSeconds int, xgCfg *data.BaseConfigType, xdb map[string]bool, xlfp *os.File, xconn *pgxpool.Pool, xctx context.Context) (md *MetricsData)
func (*MetricsData) AddCounter ¶
func (md *MetricsData) AddCounter(CounterName string, count int) (err error)
func (*MetricsData) AddFloatCounter ¶
func (md *MetricsData) AddFloatCounter(CounterName string, count float64) (err error)
func (*MetricsData) AddMetricsKeys ¶
func (md *MetricsData) AddMetricsKeys(validKeys []MetricsTypeInfo)
AddMetricsKeys add additional keys later in processing
func (*MetricsData) Close ¶
func (md *MetricsData) Close() error
func (*MetricsData) Collect ¶
func (md *MetricsData) Collect(ch chan<- prometheus.Metric)
Collect returns the metrics with values
func (*MetricsData) Describe ¶
func (md *MetricsData) Describe(ch chan<- *prometheus.Desc)
Describe returns all possible prometheus.Desc
func (*MetricsData) GetCounter ¶
func (md *MetricsData) GetCounter(CounterName string) (rv float64)
func (*MetricsData) GetData ¶
func (md *MetricsData) GetData()
func (*MetricsData) GetDataJson ¶
func (md *MetricsData) GetDataJson() (rv string)
Convert all of the data to JSON format and return as a string. This is for periodic saves
func (*MetricsData) ResetCounters ¶
func (md *MetricsData) ResetCounters()
ResetCounters starts all counters back at 0
func (*MetricsData) SaveData ¶
func (md *MetricsData) SaveData()
func (*MetricsData) SetFloatCounter ¶
func (md *MetricsData) SetFloatCounter(CounterName string, count float64) (err error)
type MetricsTypeInfo ¶
Click to show internal directories.
Click to hide internal directories.