userstats

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const NumBuckets = 168 // 7 days × 24 hours

Variables

This section is empty.

Functions

func Save

func Save(ctx context.Context, client copyClient, containerName string, store *BucketStore) error

func SaveSummary

func SaveSummary(ctx context.Context, client copyClient, containerName string, store *BucketStore) error

Types

type BucketStore

type BucketStore struct {
	LastTimestamp time.Time
	Services      map[string]*ServiceData
}

func Load

func Load(ctx context.Context, client copyClient, containerName string) (*BucketStore, error)

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(namespace string) *Reader

func (*Reader) Fetch

func (r *Reader) Fetch(service string) *ServiceSummary

func (*Reader) Scrape

func (r *Reader) Scrape(ctx context.Context)

type Scraper

type Scraper struct {
	// contains filtered or unexported fields
}

func NewScraper

func NewScraper(namespace string) *Scraper

func (*Scraper) Run

func (s *Scraper) Run(ctx context.Context)

type ServiceData

type ServiceData struct {
	Buckets     [NumBuckets][]byte // serialized HLL sketches
	BucketHours [NumBuckets]int64
}

type ServiceSummary

type ServiceSummary struct {
	UniqueUsers24h uint64 `json:"unique_users_24h"`
	UniqueUsers7d  uint64 `json:"unique_users_7d"`
}

type Summary

type Summary struct {
	UpdatedAt time.Time                 `json:"updated_at"`
	Services  map[string]ServiceSummary `json:"services"`
}

func LoadSummary

func LoadSummary(ctx context.Context, client copyClient, containerName string) (*Summary, error)

Jump to

Keyboard shortcuts

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