stats

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

stats contains implementation of http session statistics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	IsActive      *bool
	Usernames     []string
	StartedAfter  *types.CpsTime
	StoppedBefore *types.CpsTime
}

Filter represents possible filters to find session stats.

type Manager

type Manager interface {
	// Ping updates stats if exists or creates new stats.
	Ping(SessionData, PathData) (*Stats, error)
	// Find returns stats list.
	Find(Filter) ([]Stats, error)
}

Manager interfaces is used to implement stats store.

func NewManager

func NewManager(dbClient mongo.DbClient, frame time.Duration) Manager

NewManager creates new stats manager.

type PathData

type PathData struct {
	ViewID, TabID string
	Visible       bool
}

PathData represents required path info for stats.

type SessionData

type SessionData struct {
	SessionID, UserID string
}

SessionData represents required session info for stats.

type Stats

type Stats struct {
	ID        string `bson:"_id" json:"_id"`
	SessionID string `bson:"session_id" json:"session_id"`
	// Deprecated
	OldSessionID string        `bson:"id_beaker_session" json:"id_beaker_session"`
	SessionStart types.CpsTime `bson:"start" json:"start"`
	UserID       string        `bson:"user_id" json:"user_id"`
	// Deprecated
	Username        string                 `bson:"username" json:"username"`
	LastPing        types.CpsTime          `bson:"last_ping" json:"last_ping"`
	LastVisiblePath interface{}            `bson:"last_visible_path,omitempty" json:"last_visible_path,omitempty"`
	LastVisiblePing types.CpsTime          `bson:"last_visible_ping" json:"last_visible_ping"`
	VisibleDuration int64                  `bson:"visible_duration" json:"visible_duration"`
	TabDuration     map[string]interface{} `bson:"tab_duration" json:"tab_duration"`
}

Stats represents session statistics for http session by user.

Jump to

Keyboard shortcuts

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