stats

package
v0.0.0-...-c8fbfac Latest Latest
Warning

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

Go to latest
Published: May 14, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const COUNTER_TPL = "bouncer-counter-%s"
View Source
const NOTIFICATIONS_REDIS_CHAN = "bouncer-notifications"
View Source
const SET_REQUESTS_TPL = "bouncer-sset-%d"
View Source
const TOTAL_REQUESTS = "bouncer-nb-total-requests"

Variables

This section is empty.

Functions

func GetRange

func GetRange(from int64, to int64) redis.ZRangeBy

Types

type Counter

type Counter struct {
	Client *redis.Client
	Name   string
}

func (*Counter) Incr

func (c *Counter) Incr() error

func (*Counter) Val

func (c *Counter) Val() (string, int64, error)

type HitsMeasure

type HitsMeasure struct {
	Period        string `json:"period"`
	Success       int64  `json:"success"`
	CachedSuccess int64  `json:"cache_success"`
	Fail          int64  `json:"fail"`
	Invalid       int64  `json:"invalid"`
	OpError       int64  `json:"op_error"`
	NoAuth        int64  `json:"no_auth"`
}

func (*HitsMeasure) Set

func (m *HitsMeasure) Set(r model.Result, val int64)

type Manager

type Manager struct {
	Client   *redis.Client
	Counters map[string]*Counter
}

func NewManager

func NewManager(c *redis.Client) *Manager

func (*Manager) Close

func (s *Manager) Close()

func (*Manager) Counter

func (s *Manager) Counter(i model.CounterID) *Counter

func (*Manager) DeleteCookie

func (s *Manager) DeleteCookie(username string, cookie *http.Cookie) error

func (*Manager) GetHitsForPeriod

func (s *Manager) GetHitsForPeriod(from int64, to int64) (*HitsMeasure, error)

func (*Manager) GetLogs

func (s *Manager) GetLogs(from time.Time, to time.Time) (map[model.Result](*model.PackOfEvents), error)

func (*Manager) GetStats

func (s *Manager) GetStats(all_ranges map[string]int64) (*PackOfMeasures, error)

func (*Manager) HasCookie

func (s *Manager) HasCookie(username string, cookie *http.Cookie) (bool, error)

func (*Manager) RegCounter

func (s *Manager) RegCounter(i model.CounterID)

func (*Manager) StoreCookie

func (s *Manager) StoreCookie(username string, cookie *http.Cookie) error

func (*Manager) StoreEvent

func (s *Manager) StoreEvent(e *model.RequestEvent) error

type PackOfMeasures

type PackOfMeasures struct {
	A []interface{}
}

func NewPack

func NewPack() *PackOfMeasures

func (*PackOfMeasures) Append

func (m *PackOfMeasures) Append(x interface{})

func (*PackOfMeasures) ExportJSON

func (m *PackOfMeasures) ExportJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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