metrics

package module
v0.0.0-...-90a7d2a Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URI = (func() string {
	goenv.Load("test_config.env")
	return os.Getenv("uri")
})()

Functions

func ChangeGranularityOfOldHitMetrics

func ChangeGranularityOfOldHitMetrics(now MonthData)

Changes the granularity of old items. After a month, the day-level granularity will be compressed into month-level granularity. Month-level granularity is stored forever.

func GetNumberOfHitsToProtectedRoutesInMonth

func GetNumberOfHitsToProtectedRoutesInMonth(data MonthData) int64

Gets the number of hits to a protected route in a given month. Initializing the "Hits" property is redundant in this function.

func SetURI

func SetURI(uri string)

Configures the URI

func TotalUsers

func TotalUsers() int64

Returns the total number of users in the goth/users MongoDB collection.

Types

type DayData

type DayData struct {
	Year  uint32 `json:"year"`
	Month string `json:"month"`
	Day   uint32 `json:"day"`
	Hits  int    `json:"hits"`
}

Data model for which is stored every day in the database

type MonthData

type MonthData struct {
	Year  uint32 `json:"year"`
	Month string `json:"month"`
	Hits  int    `json:"hits"`
}

Month data is stored every month in the database when the granular DayData is scrapped.

type User

type User struct {
	// Username of the user.
	Username string `json:"username"`
	// User token (generated by the GenToken function).
	Token string `json:"token"`
}

Model of a user.

Jump to

Keyboard shortcuts

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