Documentation ¶
Index ¶
- Constants
- Variables
- func GroupBy(q string, labels ...string) string
- func InstantQuery(ctx context.Context, req *QueryRequest) (*promql.Result, error)
- func Now() time.Time
- func RangeQuery(ctx context.Context, req *QueryRangeRequest) (*promql.Result, error)
- func Record(ctx context.Context, e *models.Event)
- func RecordSession(s *models.Session)
- func SetupQuery(ctx context.Context, log *zap.Logger, read remote.ReadClient) context.Context
- func WriteLoop(ctx context.Context, write remote.WriteClient, flush time.Duration)
- type Engine
- type Period
- type Query
- func (q *Query) Domain(domain string) *Query
- func (q *Query) Equal(name, value string) *Query
- func (q *Query) IsNotPage(page string) *Query
- func (q *Query) IsPage(page string) *Query
- func (q *Query) MatchName(name string) *Query
- func (q *Query) MatchPage(page string) *Query
- func (q *Query) Name(name string) *Query
- func (q *Query) NameInList(names ...string) *Query
- func (q *Query) NotEqual(name, value string) *Query
- func (q *Query) NotMatchPage(page string) *Query
- func (q *Query) NotRe(name, value string) *Query
- func (q *Query) PageInList(pages ...string) *Query
- func (q *Query) PageNotInList(pages ...string) *Query
- func (q *Query) Re(name, value string) *Query
- func (q *Query) Request(modifirer ...func(string) string) QueryRangeRequest
- func (q *Query) Write(b *bytes.Buffer)
- type QueryRangeRequest
- type QueryRequest
- type TimeRange
Constants ¶
View Source
const ( Domain = "domain" Referer = "referer" Path = "path" EventName = "name" EntryPage = "entry_page" ExitPage = "exit_page" UserID = "user_id" SessionID = "session_id" )
View Source
const Day = 24 * time.Hour
View Source
const Month = 30 * Day
Variables ¶
View Source
var BounceRate = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "bounce_rate", Help: "Counts a single page view", }, []string{ Domain, SessionID, Referer, EntryPage, }, )
View Source
var Custom = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: string(customEvent), Help: "Counts events", }, []string{ EventName, Domain, UserID, Referer, Path, }, )
View Source
var VisitDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "visit_duration", Help: "Tracks how long a visitor stays on a page", }, []string{ Domain, SessionID, Referer, EntryPage, ExitPage, }, )
View Source
var Visitors = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: string(visitors), Help: "Tracks site visitors", }, []string{ Domain, UserID, Referer, Path, }, )
View Source
var Visits = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "visits", Help: "Counts a number of events per session", }, []string{ Domain, SessionID, Referer, EntryPage, ExitPage, }, )
Functions ¶
func InstantQuery ¶
func RangeQuery ¶
func RecordSession ¶
func SetupQuery ¶
Types ¶
type Query ¶
type Query struct { Series string Range TimeRange Period Period Interrval time.Duration Filters map[string]*labels.Matcher }
func (*Query) NameInList ¶
func (*Query) NotMatchPage ¶
func (*Query) PageInList ¶
func (*Query) PageNotInList ¶
type QueryRangeRequest ¶
func CurrentVisitorsQuery ¶
func CurrentVisitorsQuery(site *models.Site, nowFunc func() time.Time) QueryRangeRequest
func PageViewQuery ¶
func (*QueryRangeRequest) Validate ¶
func (q *QueryRangeRequest) Validate() error
type QueryRequest ¶
Click to show internal directories.
Click to hide internal directories.