Documentation ¶
Index ¶
- Constants
- func Execute(cfg *Config)
- func ExecuteMonthly(cfg *Config)
- func ExecuteRecovery(cfg *Config)
- func ExecuteRefresh(cfg *Config)
- func ExecuteTracker(cfg *Config)
- type App
- type AppRef
- type Collections
- type Config
- func (cfg Config) FlushExceptions()
- func (cfg Config) GetExceptions() ([]AppRef, error)
- func (cfg Config) PushApp(element *App) error
- func (cfg Config) PushDaily(id primitive.ObjectID, element *DailyMetric) error
- func (cfg Config) PushException(app *AppRef, date *time.Time) error
- func (cfg Config) PushMonthly(id primitive.ObjectID, element *Metric) error
- func (cfg Config) UpdateApp(app *App) error
- func (cfg Config) UpdateDailyList(id primitive.ObjectID, newMetricList *[]DailyMetric) error
- type DailyMetric
- type Db
- type Metric
- type StaticAppData
Constants ¶
View Source
const ( MONTHS = 12 FUNCTIONDURATION = 8 DAILY = 0 MONTHLY = 1 RECOVERY = 2 REFRESH = 3 TRACKER = 4 ROUTINELIMIT = 50 // Max number of go-routines running concurrently REFRESHROUTINELIMIT = 50 NOACTIVITYLIMIT = 3 )
Constants
View Source
const ( DBTIMEOUT = 10 DATEPATTERN = "2006-01-02 15:04:05" )
DB Constants
View Source
const ( HOURSPERDAY = 24 RETENTIONLIMIT = 90 )
Variables ¶
This section is empty.
Functions ¶
func ExecuteRecovery ¶
func ExecuteRecovery(cfg *Config)
ExecuteRecovery : Best effort to retry all exception instances
func ExecuteRefresh ¶ added in v1.0.5
func ExecuteRefresh(cfg *Config)
ExecuteRefresh updates the app library
func ExecuteTracker ¶ added in v1.0.5
func ExecuteTracker(cfg *Config)
ExecuteTracker runs a job to aggregate any apps that are worth tracking
Types ¶
type App ¶
type App struct { ID primitive.ObjectID `bson:"_id,omitempty"` Metrics []Metric `bson:"metrics"` DailyMetrics []DailyMetric `bson:"daily_metrics"` StaticData StaticAppData `bson:"static_data"` }
type AppRef ¶ added in v1.0.5
type AppRef struct { ID primitive.ObjectID `bson:"_id,omitempty"` RefID primitive.ObjectID `bson:"ref_id"` StaticData StaticAppData `bson:"static_data"` }
type Collections ¶
type Collections struct { Stats *mongo.Collection Exceptions *mongo.Collection TrackPool *mongo.Collection }
Collections struct containing MongoDB collections to be used
type Config ¶
type Config struct { Ctx context.Context Col *Collections Trace *loggers LoggerClient *logging.Client LocalEnabled bool }
Config for execution
func InitConfig ¶
func InitConfig(ctx context.Context, cols *Collections) *Config
InitConfig - initialise config struct and return pointer to it
func (Config) FlushExceptions ¶
func (cfg Config) FlushExceptions()
FlushExceptions : Clear exception queue
func (Config) GetExceptions ¶
GetExceptions - Return list of App
func (Config) PushDaily ¶
func (cfg Config) PushDaily(id primitive.ObjectID, element *DailyMetric) error
PushDaily : Insert daily metric
func (Config) PushException ¶
PushException : Insert exception instance
func (Config) PushMonthly ¶
PushMonthly : Insert new month instance
func (Config) UpdateDailyList ¶
func (cfg Config) UpdateDailyList(id primitive.ObjectID, newMetricList *[]DailyMetric) error
UpdateDailyList : Update daily metric list for app
type DailyMetric ¶
DailyMetric - Metric obj
type Db ¶
type Db interface { GetExceptions() ([]AppRef, error) PushApp(element *App) error PushDaily(id primitive.ObjectID, element *DailyMetric) error PushMonthly(id primitive.ObjectID, element *Metric) error PushException(app *AppRef, currentDateTime *time.Time) error UpdateApp(app *App) error UpdateDailyList(id primitive.ObjectID, newMetricList *[]DailyMetric) error FlushExceptions() // contains filtered or unexported methods }
Db interface
type Metric ¶
type Metric struct { Date time.Time `bson:"date"` AvgPlayers int `bson:"avgplayers"` Gain string `bson:"gain"` GainPercent string `bson:"gainpercent"` Peak int `bson:"peak"` }
Metric element
type StaticAppData ¶ added in v1.0.5
Click to show internal directories.
Click to hide internal directories.