usage

package module
v0.0.0-...-4500ca8 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvgResponseTime

func AvgResponseTime(ctx context.Context) (float64, error)

func DailyMonitorsCount

func DailyMonitorsCount(ctx context.Context) (int, error)

func DailyRequestsCount

func DailyRequestsCount(ctx context.Context) (int, error)

func DailyUsersCount

func DailyUsersCount(ctx context.Context) (int, error)

func DatabaseConnections

func DatabaseConnections(ctx context.Context) (int, error)

func DisplayUserCounts

func DisplayUserCounts(counts []UserCount)

func DisplayUserTimes

func DisplayUserTimes(users []UserTime)

func DisplayUsers

func DisplayUsers(users []User)

func HourlyMonitorsCount

func HourlyMonitorsCount(ctx context.Context) (int, error)

func HourlyRequestsCount

func HourlyRequestsCount(ctx context.Context) (int, error)

func HourlyUsersCount

func HourlyUsersCount(ctx context.Context) (int, error)

func MonitorsCount

func MonitorsCount(ctx context.Context, interval string) (int, error)

func MonthlyMonitorsCount

func MonthlyMonitorsCount(ctx context.Context) (int, error)

func MonthlyRequestsCount

func MonthlyRequestsCount(ctx context.Context) (int, error)

func MonthlyUsersCount

func MonthlyUsersCount(ctx context.Context) (int, error)

func RequestsCount

func RequestsCount(ctx context.Context, interval string) (int, error)

func TableColumnSize

func TableColumnSize(ctx context.Context, table, column string) (string, string, float64, error)

func TableSize

func TableSize(ctx context.Context, table string) (string, error)

func TestAvgResponseTime

func TestAvgResponseTime(t *testing.T)

func TestDailyRequests

func TestDailyRequests(t *testing.T)

func TestDailyRequestsCount

func TestDailyRequestsCount(t *testing.T)

func TestLocations

func TestLocations(t *testing.T)

func TestMonthlyRequests

func TestMonthlyRequests(t *testing.T)

func TestMonthlyRequestsCount

func TestMonthlyRequestsCount(t *testing.T)

func TestMonthlyUserRequests

func TestMonthlyUserRequests(t *testing.T)

func TestRequests

func TestRequests(t *testing.T)

func TestRequestsCount

func TestRequestsCount(t *testing.T)

func TestTopFrameworks

func TestTopFrameworks(t *testing.T)

func TestTopIPAddresses

func TestTopIPAddresses(t *testing.T)

func TestTopUserAgents

func TestTopUserAgents(t *testing.T)

func TestUserRequests

func TestUserRequests(t *testing.T)

func TestUserRequestsCount

func TestUserRequestsCount(t *testing.T)

func TestWeeklyRequests

func TestWeeklyRequests(t *testing.T)

func TestWeeklyRequestsCount

func TestWeeklyRequestsCount(t *testing.T)

func TestWeeklyUserRequests

func TestWeeklyUserRequests(t *testing.T)

func TotalMonitorsCount

func TotalMonitorsCount(ctx context.Context) (int, error)

func TotalRequestsCount

func TotalRequestsCount(ctx context.Context) (int, error)

func TotalUsersCount

func TotalUsersCount(ctx context.Context) (int, error)

func UsersCount

func UsersCount(ctx context.Context, interval string) (int, error)

func WeeklyMonitorsCount

func WeeklyMonitorsCount(ctx context.Context) (int, error)

func WeeklyRequestsCount

func WeeklyRequestsCount(ctx context.Context) (int, error)

func WeeklyUsersCount

func WeeklyUsersCount(ctx context.Context) (int, error)

Types

type ColumnValueCount

type ColumnValueCount[T any] struct {
	Value T
	Count int
}

func ColumnValuesCount

func ColumnValuesCount[T any](ctx context.Context, column string) ([]ColumnValueCount[T], error)

func TopFrameworks

func TopFrameworks(ctx context.Context) ([]ColumnValueCount[int], error)

func TopIPAddresses

func TopIPAddresses(ctx context.Context) ([]ColumnValueCount[string], error)

func TopLocations

func TopLocations(ctx context.Context) ([]ColumnValueCount[string], error)

func TopUserAgents

func TopUserAgents(ctx context.Context) ([]ColumnValueCount[string], error)

type MonitorRow

type MonitorRow struct {
	APIKey    string    `json:"api_key"`
	URL       string    `json:"url"`
	Secure    bool      `json:"secure"`
	Ping      bool      `json:"ping"`
	CreatedAt time.Time `json:"created_at"`
}

func DailyMonitors

func DailyMonitors(ctx context.Context) ([]MonitorRow, error)

func HourlyMonitors

func HourlyMonitors(ctx context.Context) ([]MonitorRow, error)

func Monitors

func Monitors(ctx context.Context, interval string) ([]MonitorRow, error)

func MonthlyMonitors

func MonthlyMonitors(ctx context.Context) ([]MonitorRow, error)

func TotalMonitors

func TotalMonitors(ctx context.Context) ([]MonitorRow, error)

func WeeklyMonitors

func WeeklyMonitors(ctx context.Context) ([]MonitorRow, error)

type RequestRow

type RequestRow struct {
	RequestID    int            `json:"request_id"`
	APIKey       string         `json:"api_key"`
	Path         string         `json:"path"`
	Hostname     sql.NullString `json:"hostname"`
	IPAddress    sql.NullString `json:"ip_address"`
	Location     sql.NullString `json:"location"`
	UserAgentID  sql.NullInt64  `json:"user_agent_id"`
	Method       int16          `json:"method"`
	Status       int16          `json:"status"`
	ResponseTime int16          `json:"response_time"`
	Framework    int16          `json:"framework"`
	CreatedAt    time.Time      `json:"created_at"`
}

func DailyRequests

func DailyRequests(ctx context.Context) ([]RequestRow, error)

func HourlyRequests

func HourlyRequests(ctx context.Context) ([]RequestRow, error)

func MonthlyRequests

func MonthlyRequests(ctx context.Context) ([]RequestRow, error)

func Requests

func Requests(ctx context.Context, interval string) ([]RequestRow, error)

func TotalRequests

func TotalRequests(ctx context.Context) ([]RequestRow, error)

func WeeklyRequests

func WeeklyRequests(ctx context.Context) ([]RequestRow, error)

type RequestsColumnSizes

type RequestsColumnSizes struct {
	RequestID    string `json:"request_id"`
	APIKey       string `json:"api_key"`
	Path         string `json:"path"`
	Hostname     string `json:"hostname"`
	IPAddress    string `json:"ip_address"`
	Location     string `json:"location"`
	UserAgent    string `json:"user_agent"`
	Method       string `json:"method"`
	Status       string `json:"status"`
	ResponseTime string `json:"response_time"`
	Framework    string `json:"framework"`
	CreatedAt    string `json:"created_at"`
}

func RequestsColumnSize

func RequestsColumnSize(ctx context.Context) (RequestsColumnSizes, error)

func (RequestsColumnSizes) Display

func (r RequestsColumnSizes) Display()

type User

type User struct {
	APIKey         string    `json:"api_key"`
	TotalRequests  int       `json:"total_requests"`
	DailyRequests  int       `json:"daily_requests"`
	WeeklyRequests int       `json:"weekly_requests"`
	CreatedAt      time.Time `json:"created_at"`
}

func TopUsers

func TopUsers(ctx context.Context, n int) ([]User, error)

func (User) Display

func (user User) Display(rank int)

type UserCount

type UserCount struct {
	APIKey string
	Count  int
}

func DailyUserMonitors

func DailyUserMonitors(ctx context.Context) ([]UserCount, error)

func DailyUserRequests

func DailyUserRequests(ctx context.Context) ([]UserCount, error)

func HourlyUserMonitors

func HourlyUserMonitors(ctx context.Context) ([]UserCount, error)

func HourlyUserRequests

func HourlyUserRequests(ctx context.Context) ([]UserCount, error)

func MonthlyUserMonitors

func MonthlyUserMonitors(ctx context.Context) ([]UserCount, error)

func MonthlyUserRequests

func MonthlyUserRequests(ctx context.Context) ([]UserCount, error)

func TotalUserMonitors

func TotalUserMonitors(ctx context.Context) ([]UserCount, error)

func TotalUserRequests

func TotalUserRequests(ctx context.Context) ([]UserCount, error)

func UserMonitors

func UserMonitors(ctx context.Context, interval string) ([]UserCount, error)

func UserRequests

func UserRequests(ctx context.Context, interval string) ([]UserCount, error)

func UserRequestsOverLimit

func UserRequestsOverLimit(ctx context.Context, limit int) ([]UserCount, error)

func WeeklyUserMonitors

func WeeklyUserMonitors(ctx context.Context) ([]UserCount, error)

func WeeklyUserRequests

func WeeklyUserRequests(ctx context.Context) ([]UserCount, error)

func (UserCount) Display

func (u UserCount) Display()

type UserRow

type UserRow struct {
	UserID    string    `json:"user_id"`
	APIKey    string    `json:"api_key"`
	CreatedAt time.Time `json:"created_at"`
}

func DailyUsers

func DailyUsers(ctx context.Context) ([]UserRow, error)

func HourlyUsers

func HourlyUsers(ctx context.Context) ([]UserRow, error)

func MonthlyUsers

func MonthlyUsers(ctx context.Context) ([]UserRow, error)

func TotalUsers

func TotalUsers(ctx context.Context) ([]UserRow, error)

func Users

func Users(ctx context.Context, interval string) ([]UserRow, error)

func WeeklyUsers

func WeeklyUsers(ctx context.Context) ([]UserRow, error)

type UserTime

type UserTime struct {
	APIKey    string    `json:"api_key"`
	CreatedAt time.Time `json:"created_at"`
	Days      string    `json:"days"`
}

func SinceLastRequestUsers

func SinceLastRequestUsers(ctx context.Context) ([]UserTime, error)

func UnusedUsers

func UnusedUsers(ctx context.Context) ([]UserTime, error)

func UnusedUsersMonitors

func UnusedUsersMonitors(ctx context.Context) ([]UserTime, error)

func UnusedUsersRequests

func UnusedUsersRequests(ctx context.Context) ([]UserTime, error)

func (UserTime) Display

func (user UserTime) Display(rank int)

Jump to

Keyboard shortcuts

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