Documentation ¶
Index ¶
- func CreateHtml(tableBody string) string
- func CreateTableHtml(col, title, header, body string) string
- func CreateTablePart(col, title, header, body string) string
- type ConcurrenceMap
- type ErrorInfo
- type HideReaddirFS
- type ItemMap
- func (ctx *ItemMap) Exists(key string) bool
- func (ctx *ItemMap) Get(key string) (value interface{}, exists bool)
- func (ctx *ItemMap) GetCurrentMap() map[string]interface{}
- func (ctx *ItemMap) GetInt(key string) int
- func (ctx *ItemMap) GetString(key string) string
- func (ctx *ItemMap) GetTimeDuration(key string) time.Duration
- func (ctx *ItemMap) GetUInt64(key string) uint64
- func (ctx *ItemMap) Len() int
- func (ctx *ItemMap) Once(key string) (value interface{}, exists bool)
- func (ctx *ItemMap) Remove(key string)
- func (ctx *ItemMap) Set(key string, value interface{})
- type ReadonlyMap
- type RequestInfo
- type ServerStateInfo
- func (state *ServerStateInfo) AddCurrentRequest(num uint64) uint64
- func (state *ServerStateInfo) AddErrorCount(page string, err error, num uint64) uint64
- func (state *ServerStateInfo) AddRequestCount(page string, code int, num uint64)
- func (state *ServerStateInfo) QueryIntervalErrorData(queryKey string) uint64
- func (state *ServerStateInfo) QueryIntervalRequestData(queryKey string) uint64
- func (state *ServerStateInfo) ShowHtmlDataRaw(version, globalUniqueId string) string
- func (state *ServerStateInfo) ShowHtmlTableData(version, globalUniqueId string) string
- func (state *ServerStateInfo) SubCurrentRequest(num uint64) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHtml ¶ added in v1.7.9
CreateHtml create a complete page html by replacing {{tableBody}}
func CreateTableHtml ¶ added in v1.7.7
CreateTableHtml create a complete page html by replacing {{tableBody}} and table part html
func CreateTablePart ¶ added in v1.7.9
CreateTablePart create a table part html by replacing flags
Types ¶
type ConcurrenceMap ¶
type ConcurrenceMap interface { Get(key string) (value interface{}, exists bool) GetString(key string) string GetTimeDuration(key string) time.Duration GetInt(key string) int GetUInt64(key string) uint64 Exists(key string) bool GetCurrentMap() map[string]interface{} Len() int Set(key string, value interface{}) Remove(key string) Once(key string) (value interface{}, exists bool) }
ReadonlyMap support concurrence for map
func NewConcurrenceMap ¶
func NewConcurrenceMap() ConcurrenceMap
NewConcurrenceMap create new ConcurrenceMap
type HideReaddirFS ¶
type HideReaddirFS struct {
FileSystem http.FileSystem
}
FileSystem with hide Readdir
type ItemMap ¶
ItemMap concurrence map
func (*ItemMap) GetCurrentMap ¶
GetCurrentMap get current map, returns map[string]interface{}
func (*ItemMap) GetString ¶
GetString returns value as string specified by key return empty string if key not exists
func (*ItemMap) GetTimeDuration ¶
GetTimeDuration returns value as time.Duration specified by key return 0 if key not exists or value cannot be converted to time.Duration
func (*ItemMap) GetUInt64 ¶
GetUInt64 returns value as uint64 specified by key return 0 if key not exists or value cannot be converted to int64
func (*ItemMap) Once ¶
Once get item by gived key, and remove it only can be read once, it will be locked
type ReadonlyMap ¶
type ReadonlyMap interface { Get(key string) (value interface{}, exists bool) GetString(key string) string GetTimeDuration(key string) time.Duration GetInt(key string) int GetUInt64(key string) uint64 Exists(key string) bool Len() int }
ReadonlyMap only support readonly method for map
type RequestInfo ¶
http request count info
type ServerStateInfo ¶
type ServerStateInfo struct { ServerStartTime time.Time // enable detailed request statistics, fixes #63 request statistics, high memory usage when URL number is high EnabledDetailRequestData bool TotalRequestCount uint64 // active request count CurrentRequestCount uint64 // request statistics per minute IntervalRequestData *ItemMap // detailed request statistics, the key is url without parameters DetailRequestURLData *ItemMap TotalErrorCount uint64 // request error statistics per minute IntervalErrorData *ItemMap // detailed request error statistics, the key is url without parameters DetailErrorPageData *ItemMap // detailed error statistics, the key is url without parameters DetailErrorData *ItemMap // detailed reponse statistics of http code, the key is HttpCode, e.g. 200, 500 etc. DetailHTTPCodeData *ItemMap // contains filtered or unexported fields }
Server state
func NewServerStateInfo ¶
func NewServerStateInfo() *ServerStateInfo
NewServerStateInfo return ServerStateInfo which is init
func (*ServerStateInfo) AddCurrentRequest ¶
func (state *ServerStateInfo) AddCurrentRequest(num uint64) uint64
AddCurrentRequest increment current request count
func (*ServerStateInfo) AddErrorCount ¶
func (state *ServerStateInfo) AddErrorCount(page string, err error, num uint64) uint64
AddErrorCount add error count
func (*ServerStateInfo) AddRequestCount ¶
func (state *ServerStateInfo) AddRequestCount(page string, code int, num uint64)
AddRequestCount add request count
func (*ServerStateInfo) QueryIntervalErrorData ¶
func (state *ServerStateInfo) QueryIntervalErrorData(queryKey string) uint64
QueryIntervalErrorData query error count by query time
func (*ServerStateInfo) QueryIntervalRequestData ¶
func (state *ServerStateInfo) QueryIntervalRequestData(queryKey string) uint64
QueryIntervalRequestData query request count by query time
func (*ServerStateInfo) ShowHtmlDataRaw ¶ added in v1.7.7
func (state *ServerStateInfo) ShowHtmlDataRaw(version, globalUniqueId string) string
ShowHtmlDataRaw show server state data html-string format
func (*ServerStateInfo) ShowHtmlTableData ¶ added in v1.7.7
func (state *ServerStateInfo) ShowHtmlTableData(version, globalUniqueId string) string
ShowHtmlData show server state data html-table format
func (*ServerStateInfo) SubCurrentRequest ¶
func (state *ServerStateInfo) SubCurrentRequest(num uint64) uint64
SubCurrentRequest subtract current request count